削除されたサーバーから専用 SQL プール (旧称 SQL DW) を復元する

この記事では、PowerShell を使用してサーバーを誤って破棄した後、Azure Synapse Analytics で専用 SQL プール (旧称 SQL DW) を復元する方法について説明します。

注意

このガイダンスは、スタンドアロンの専用 SQL プール (旧称 SQL DW) のみを対象としています。 Azure Synapse Analytics ワークスペースの専用 SQL プールについては、削除されたワークスペースからの SQL プールの復元に関する記事を参照してください。

開始する前に

注意

Azure を操作するには、Azure Az PowerShell モジュールを使用することをお勧めします。 作業を開始するには、Azure PowerShell のインストールに関する記事を参照してください。 Az PowerShell モジュールに移行する方法については、「AzureRM から Az への Azure PowerShell の移行」を参照してください。

削除されたサーバーから SQL プールを復元する

  1. PowerShell を開きます。

  2. Azure アカウントに接続します。

  3. 破棄されたサーバーを含むサブスクリプションにコンテキストを設定します。

  4. サーバーが破棄されたおおよその日時を指定します。

  5. 破棄されたサーバーから復旧するデータベースのリソース ID を作成します。

  6. 破棄されたサーバーからデータベースを復元します

  7. 復旧したデータベースの状態が "オンライン" であることを確認します。

$SubscriptionID="<YourSubscriptionID>"
$ResourceGroupName="<YourResourceGroupName>"
$ServerName="<YourServerNameWithoutURLSuffixSeeNote>"  # Without database.windows.net
$DatabaseName="<YourDatabaseName>"
$TargetServerName="<YourtargetServerNameWithoutURLSuffixSeeNote>"  
$TargetDatabaseName="<YourDatabaseName>"

Connect-AzAccount
Set-AzContext -SubscriptionId $SubscriptionID

# Define the approximate point in time the server was dropped as DroppedDateTime "yyyy-MM-ddThh:mm:ssZ" (ex. 2022-01-01T16:15:00Z)
$PointInTime="<DroppedDateTime>" 
$DroppedDateTime = Get-Date -Date $PointInTime 

# construct the resource ID of the database you wish to recover. The format required Microsoft.Sql. This includes the approximate date time the server was dropped.
$SourceDatabaseID = "/subscriptions/"+$SubscriptionID+"/resourceGroups/"+$ResourceGroupName+"/providers/Microsoft.Sql/servers/"+$ServerName+"/restorableDroppedDatabases/"+$DatabaseName+","+$DroppedDateTime.ToUniversalTime().ToFileTimeUtc().ToString()

# Restore to target workspace with the source database.
$RestoredDatabase = Restore-AzSqlDatabase -FromDeletedDatabaseBackup -DeletionDate $DroppedDateTime -ResourceGroupName $ResourceGroupName -ServerName $TargetServerName -TargetDatabaseName $TargetDatabaseName -ResourceId $SourceDatabaseID 

# Verify the status of restored database
$RestoredDatabase.status

トラブルシューティング

"An unexpected error occurred while processing the request."(要求の処理中に予期しないエラーが発生しました) というメッセージが受信された場合、元のサーバーの有効期間が短かったため、元のデータベースに復旧ポイントがない可能性があります。 これは通常、サーバーの存在が 1 時間に満たない場合です。