Start-AzureSqlDatabaseRecovery

Initiates a restore request for a database.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Start-AzureSqlDatabaseRecovery
     -SourceServerName <String>
     -SourceDatabaseName <String>
     [-TargetServerName <String>]
     [-TargetDatabaseName <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSqlDatabaseRecovery
     -SourceDatabase <RecoverableDatabase>
     [-TargetServerName <String>]
     [-TargetDatabaseName <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]

Description

The Start-AzureSqlDatabaseRecovery cmdlet initiates a restore request for a live or dropped database. This cmdlet supports basic recovery that uses the last known available backup for the database. The recovery operation creates a new database. If you recover a live database on the same server, you must specify a different name for the new database.

To do a point in time restore for a database, use the Start-AzureSqlDatabaseRestore cmdlet instead.

Examples

Example 1: Recover a database specified as an object

PS C:\> $Database = Get-AzureSqlRecoverableDatabase -ServerName "Server01" -DatabaseName "Database17" 
PS C:\> $Operation = Start-AzureSqlDatabaseRecovery -SourceDatabase $Database -TargetDatabaseName "DatabaseRestored"

The first command gets a database object by using the Get-AzureSqlRecoverableDatabase cmdlet. The command stores that object in the $Database variable.

The second command recovers the database stored in $Database.

Example 2: Recover a database specified by name

PS C:\> $Operation = Start-AzureSqlDatabaseRecovery -SourceServerName "Server01" -SourceDatabaseName "Database17" -TargetDatabaseName "DatabaseRestored"

This command recovers a database using the database name.

Parameters

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SourceDatabase

Specifies the database object that represents the database that this cmdlet recovers.

Type:RecoverableDatabase
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SourceDatabaseName

Specifies the name of the database that this cmdlet recovers.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SourceServerName

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.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-TargetDatabaseName

Specifies the name of the recovered database. If the source database is still live, in order to recover it to the same server, you must specify a name that differs from the source database name.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TargetServerName

Specifies the name of the server to which to restore a database. You can restore a database to the same server or to a different server.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

RecoverableDatabase

Outputs

RecoverDatabaseOperation

Notes

  • You must use certificate-based authentication to run this cmdlet. Run the following commands on the computer where you 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"