この記事では、PowerShell を使用してサーバーが誤って削除された後、Azure Synapse Analytics で専用 SQL プール (旧称 SQL DW) を復元する方法について説明します。
注
このガイダンスは、スタンドアロンの専用 SQL プール (旧称 SQL DW) のみを対象としています。 Azure Synapse Analytics ワークスペース内の専用 SQL プールについては、「 削除されたワークスペースから SQL プールを復元する」を参照してください。
開始する前に
注
Azure Az PowerShell モジュールを使用して Azure と対話することをお勧めします。 作業を始めるには、「Azure PowerShell をインストールする」を参照してください。 Az PowerShell モジュールに移行する方法については、「Azure PowerShell を AzureRM から Azに移行する」を参照してください。
削除されたサーバーから SQL プールを復元する
PowerShell を開きます。
Azure アカウントに接続します。
コンテキストを、削除されたサーバーを含むサブスクリプションに設定します。
サーバーが削除されたおおよその日時を指定します。
削除されたサーバーから復旧するデータベースのリソース ID を作成します。
削除されたサーバーからデータベースを復元する
復旧したデータベースの状態が "オンライン" であることを確認します。
$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
トラブルシューティング
"要求の処理中に予期しないエラーが発生しました" というメッセージが表示された場合は、元のサーバーの有効期間が短いため、元のデータベースに復旧ポイントがない可能性があります。 通常、これは、サーバーが 1 時間未満で存在した場合です。