共用方式為


Start-AzureSqlDatabaseRecovery

起始資料庫的還原要求。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

語法

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

Start-AzureSqlDatabaseRecovery Cmdlet 會起始即時或已卸除資料庫的還原要求。 此 Cmdlet 支援使用資料庫上次已知可用備份的基本復原。 復原作業會建立新的資料庫。 如果您在相同伺服器上復原實時資料庫,則必須為新資料庫指定不同的名稱。

若要為資料庫執行時間點還原,請改用 Start-AzureSqlDatabaseRestore Cmdlet。

範例

範例 1:復原指定為 對象的資料庫

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

第一個命令會使用 Get-AzureSqlRecoverableDatabase Cmdlet 來取得資料庫物件。 命令會將該物件儲存在 $Database 變數中。

第二個命令會復原儲存在 $Database 中的資料庫。

範例 2:復原依名稱指定的資料庫

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

此命令會使用資料庫名稱來復原資料庫。

參數

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-SourceDatabase

指定代表此 Cmdlet 所復原之資料庫的資料庫物件。

類型:RecoverableDatabase
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-SourceDatabaseName

指定這個 Cmdlet 所復原的資料庫名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-SourceServerName

指定源資料庫執行所在的伺服器名稱,或源資料庫在刪除之前執行的伺服器名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-TargetDatabaseName

指定復原的資料庫名稱。 如果源資料庫仍在使用中,若要將它復原到相同的伺服器,您必須指定與源資料庫名稱不同的名稱。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-TargetServerName

指定要還原資料庫之伺服器的名稱。 您可以將資料庫還原至相同伺服器或不同的伺服器。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

輸入

RecoverableDatabase

輸出

RecoverDatabaseOperation

備註

  • 您必須使用憑證式驗證來執行此 Cmdlet。 在執行此 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"