SALES: 1-800-867-1380

Start-AzureSqlDatabaseRestore

Updated: January 5, 2016

Applies To: Azure PowerShell 1.0

Start-AzureSqlDatabaseRestore

Performs a point in time restore of a database.

Syntax

Parameter Set: BySourceDatabaseName
Start-AzureSqlDatabaseRestore [-SourceServerName] <String> [-SourceDatabaseName] <String> -TargetDatabaseName <String> [-PointInTime <DateTime]> ] [-Profile <AzureProfile> ] [-TargetServerName <String> ] [ <CommonParameters>]

Parameter Set: BySourceDatabaseObject
Start-AzureSqlDatabaseRestore [[-SourceServerName] <String> ] [-SourceDatabase] <Database> -TargetDatabaseName <String> [-PointInTime <DateTime]> ] [-Profile <AzureProfile> ] [-TargetServerName <String> ] [ <CommonParameters>]

Parameter Set: BySourceRestorableDroppedDatabaseName
Start-AzureSqlDatabaseRestore [-SourceServerName] <String> [-SourceDatabaseName] <String> [-SourceDatabaseDeletionDate] <DateTime> -RestorableDropped -TargetDatabaseName <String> [-PointInTime <DateTime]> ] [-Profile <AzureProfile> ] [-TargetServerName <String> ] [ <CommonParameters>]

Parameter Set: BySourceRestorableDroppedDatabaseObject
Start-AzureSqlDatabaseRestore [[-SourceServerName] <String> ] [-SourceRestorableDroppedDatabase] <RestorableDroppedDatabase> -TargetDatabaseName <String> [-PointInTime <DateTime]> ] [-Profile <AzureProfile> ] [-TargetServerName <String> ] [ <CommonParameters>]




Detailed Description

The Start-AzureSqlDatabaseRestore cmdlet performs a point in time restore of a Basic, Standard or Premium database. Azure SQL Database retains Basic database backups 7 days, Standard for 14 days, and Premium for 35 days. The restore operation creates a new database. If the source database is not deleted, the SourceDatabaseName and TargetDatabaseName parameter must have different values.

Azure SQL Database does not currently support cross server restore. The source and target server names must be the same.

Parameters

-PointInTime<DateTime]>

Specifies the restore point to which to restore the database. When the restore operation finishes, the database is restored to the state it was at the date and time that this parameter specifies. By default, for a live database this set to the current time, and for a dropped database, this cmdlet uses the time when the database was dropped.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Profile<AzureProfile>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RestorableDropped

Indicates that this cmdlet restores a restorable dropped database.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SourceServerName<String>

Specifies the name of the server on which the source database is live and running, or on which the source database ran before it was deleted.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SourceDatabase<Database>

Specifies the name of the database that this cmdlet restores.


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-SourceDatabaseDeletionDate<DateTime>

Specifies the date and time when the database was deleted. You must include milliseconds when you specify the time to match the actual database deletion time.


Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SourceDatabaseName<String>

Specifies the name of the live database that this cmdlet restores.


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SourceRestorableDroppedDatabase<RestorableDroppedDatabase>

Specifies an object that represents the restorable dropped database that this cmdlet restores. To obtain a RestorableDroppedDatabase object, use the Get-AzureSqlDatabase cmdlet, and specify the RestorableDropped parameter.


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-TargetDatabaseName<String>

Specifies the name of the new database that the restore operation creates.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-TargetServerName<String>

Specifies the name of the server to which this cmdlet restores the database.

Azure SQL Database does not currently support cross server restore. The source and target server names must be the same.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.RestorableDroppedDatabase
  • Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.Database

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.RestoreDatabaseOperation

Notes

  • You must use certificate based authentication to run this cmdlet. Run the following commands on the computer where run this cmdlet:

    PS C:\> $subId = <Subscription ID>
    PS C:\> $thumbprint = <Certificate Thumbprint>
    PS C:\> $myCert = Get-Item Cert:\CurrentUser\My\$thumbprint
    PS C:\> Set-AzureSubscription -SubscriptionName "mySubscription" -SubscriptionId $subId -Certificate $myCert
    PS C:\> Select-AzureSubscription -SubscriptionName "mySubscription"

Examples

Example 1: Restore a database specified as an object to a point in time

The first command gets a database object for the database named Database17 on the server named Server01, and then stores it in the $Database variable.

The second command restores the database to a specific point in time. The command specifies at name for the new database.


PS C:\> $Database = Get-AzureSqlDatabase -ServerName "Server01" -DatabaseName "Database17" 
PS C:\> $Operation = Start-AzureSqlDatabaseRestore -SourceDatabase $Database -TargetDatabaseName "DatabaseRestored" -PointInTime "2013-01-01 06:00:00"

Example 2: Restore a database specified by name to a point in time

This command restores the database named Database17 to a specific point in time. The command specifies at name for the new database.


PS C:\> $Operation = Start-AzureSqlDatabaseRestore -SourceServerName "Server01" -SourceDatabaseName "Database17" -TargetDatabaseName "DatabaseRestored" -PointInTime "2013-01-01 06:00:00" 

Example 3: Restore a dropped database specified as an object to a point in time

The first command gets a database object for the database named Database01 on the server named Server01. The command specifies the RestorableDropped parameter. Therefore, the cmdlet gets restorable dropped database the specified restore point. The command stores that database object in the $Database variable.

The second command restores the dropped database specified by $Database. The command specifies at name for the new database.


PS C:\> $Database = Get-AzureSqlDatabase -RestorableDropped -ServerName "Server01" -DatabaseName "Database01" -DatabaseDeletionDate "2012-11-09T22:59:43.000Z" 
PS C:\> $Operation = Start-AzureSqlDatabaseRestore -SourceRestorableDroppedDatabase $Database -TargetDatabaseName "DroppedDatabaseRestored" 

Related topics

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2016 Microsoft