既存の専用 SQL プール (旧称 SQL DW) を復元する

この記事では、Azure portal と PowerShell を使用して、既存の専用 SQL プール (旧称 SQL DW) を復元する方法について説明します。

Note

このガイダンスは、スタンドアロンの専用 SQL プール (旧称 SQL DW) のみを対象としています。 Azure Synapse Analytics ワークスペースの専用 SQL プールについては、「既存の専用 SQL プールを復元する」を参照してください。

開始する前に

  1. DTU 容量を確認します。 各プールは、既定の DTU クォータを持つ論理 SQL サーバー(たとえば myserver.database.windows.net) によってホストされています。 データベースを復元するための十分な DTU クォータがサーバーに残っていることを確認します。 必要な DTU を計算する方法と DTU を要求する方法については、 DTU クォータの変更の要求に関するトピックをご覧ください。

  2. 必ず Azure PowerShell をインストールしてください。

    注意

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

  3. 復元する既存の復元ポイントがあること。 新しい復元を作成する場合は、「the tutorial to create a new user-defined restore point」 (新しいユーザー定義の復元ポイントを作成するチュートリアル) を参照してください。

PowerShell を使用して既存の専用 SQL プール (旧称 SQL DW) を復元する

復元ポイントから既存の専用 SQL プール (旧称 SQL DW) を復元するには、Restore-AzSqlDatabase PowerShell コマンドレットを使用します。

  1. PowerShell を開きます。

  2. Azure アカウントに接続して、アカウントに関連付けられているすべてのサブスクリプションを一覧表示します。

  3. 復元するデータベースを含むサブスクリプションを選択します。

  4. 専用 SQL プール (旧称 SQL DW) の復元ポイントを一覧表示します。

  5. RestorePointCreationDate を使用して、目的の復元ポイントを選択します。

  6. Restore-AzSqlDatabase PowerShell コマンドレットを使用して、目的の復元ポイントに専用 SQL プール (旧称 SQL DW) を復元します。

    1. 専用 SQL プール (旧称 SQL DW) を別のサーバーに復元するには、必ず他のサーバー名を指定します。 このサーバーは、別のリソース グループとリージョン内に存在していてもかまいません。
    2. 別のサブスクリプションに復元するには、この後のセクションを参照してください。
  7. 復元された専用 SQL プール (旧称 SQL DW)がオンラインになっていることを確認します。

  8. 復元が完了したら、復旧後のデータベースの構成の手順に従って、復旧された専用 SQL プール (旧称 SQL DW) を構成できます。

    
    $SubscriptionName="<YourSubscriptionName>"
    $ResourceGroupName="<YourResourceGroupName>"
    $ServerName="<YourServerNameWithoutURLSuffixSeeNote>"  # Without database.windows.net
    #$TargetResourceGroupName="<YourTargetResourceGroupName>" # uncomment to restore to a different server.
    #$TargetServerName="<YourtargetServerNameWithoutURLSuffixSeeNote>"  
    $DatabaseName="<YourDatabaseName>"
    $NewDatabaseName="<YourDatabaseName>"
    
    Connect-AzAccount
    Get-AzSubscription
    Select-AzSubscription -SubscriptionName $SubscriptionName
    
    # Or list all restore points
    Get-AzSqlDatabaseRestorePoint -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName
    
    # Get the specific database to restore
    $Database = Get-AzSqlDatabase -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName
    
    # Pick desired restore point using RestorePointCreationDate "xx/xx/xxxx xx:xx:xx xx"
    $PointInTime="<RestorePointCreationDate>"
    
    # Restore database from a restore point
    $RestoredDatabase = Restore-AzSqlDatabase –FromPointInTimeBackup –PointInTime $PointInTime -ResourceGroupName $Database.ResourceGroupName -ServerName $Database.ServerName -TargetDatabaseName $NewDatabaseName –ResourceId $Database.ResourceID
    
    # Use the following command to restore to a different server
    #$TargetResourceGroupName = $Database.ResourceGroupName # for restoring to different server in same resourcegroup 
    #$RestoredDatabase = Restore-AzSqlDatabase –FromPointInTimeBackup –PointInTime $PointInTime -ResourceGroupName $TargetResourceGroupName -ServerName $TargetServerName -TargetDatabaseName $NewDatabaseName –ResourceId $Database.ResourceID
    
    # Verify the status of restored database
    $RestoredDatabase.status
    

Azure portal を使用して既存の専用 SQL プール (旧称 SQL DW) を復元する

  1. Azure portal にサインインします。

  2. 復元する元の専用 SQL プールに移動します。

  3. [概要] ページで、[復元] を選択します。

    Screenshot from the Azure portal, the Overview page navigation bar of a SQL pool, the Restore button is highlighted.

  4. [自動復元ポイント] または [ユーザー定義の復元ポイント] を選択します。 専用 SQL プール (旧称 SQL DW) に自動復元ポイントがない場合は、数時間待つか、復元する前にユーザー定義の復元ポイントを作成します。 ユーザー定義の復元ポイントを使用する場合は、既存のものを選択するか、新しく作成します。 サーバーの場合は、別のリソース グループとリージョン内のサーバーを選択するか、新しく作成することができます。 すべてのパラメーターを指定したら、[レビューと復元] を選びます。

    Screenshot from the dedicated SQL pool Restore page of the Azure portal. For Restore point type, the radio button for User-defined restore points is selected.

PowerShell を使用して既存の専用 SQL プール (旧称 SQL DW) を別のサブスクリプションに復元する

これは既存の専用 SQL プールを復元する場合と同様のガイダンスですが、下記の手順では、元のサブスクリプションで Get-AzSqlDatabase PowerShell コマンドレットを実行する必要がある一方で、ターゲット サブスクリプションでは Restore-AzSqlDatabase PowerShell コマンドレットを実行する必要があることを示しています。 復元を実行するユーザーには、ソースとターゲットの両方のサブスクリプションで適切なアクセス許可が必要です。

  1. PowerShell を開きます。

  2. 以前のバージョンを使っている場合は、Update-Module を使って Az.Sql モジュールを 3.8.0 (またはそれ以降) に更新します。 そうしないと、エラーが発生します。 PowerShell を使用してバージョンを検証するには:

    foreach ($i in (get-module -ListAvailable | ?{$_.name -eq 'az.sql'}).Version) { $version = [string]$i.Major + "." + [string]$i.Minor; if ($version -gt 3.7) {write-host "Az.Sql version $version installed. Prequisite met."} else {update-module az.sql} }
    
  3. Azure アカウントに接続して、アカウントに関連付けられているすべてのサブスクリプションを一覧表示します。

  4. 復元するデータベースを含むサブスクリプションを選択します。

  5. 専用 SQL プール (旧称 SQL DW) の復元ポイントを一覧表示します。

  6. RestorePointCreationDate を使用して、目的の復元ポイントを選択します。

  7. データベースを復元するターゲット サブスクリプションを選択します。

  8. Restore-AzSqlDatabase PowerShell コマンドレットを使用して、目的の復元ポイントに専用 SQL プール (旧称 SQL DW) を復元します。

  9. 復元された専用 SQL プール (旧称 SQL DW)がオンラインになっていることを確認します。

    $SourceSubscriptionName="<YourSubscriptionName>"
    $SourceResourceGroupName="<YourResourceGroupName>"
    $SourceServerName="<YourServerNameWithoutURLSuffixSeeNote>"  # Without database.windows.net
    $SourceDatabaseName="<YourDatabaseName>"
    $TargetSubscriptionName="<YourTargetSubscriptionName>"
    $TargetResourceGroupName="<YourTargetResourceGroupName>"
    $TargetServerName="<YourTargetServerNameWithoutURLSuffixSeeNote>"  # Without database.windows.net
    $TargetDatabaseName="<YourDatabaseName>"
    
    # Update Az.Sql module to the latest version (3.8.0 or above)
    # Update-Module -Name Az.Sql -RequiredVersion 3.8.0
    
    Connect-AzAccount
    Get-AzSubscription
    Select-AzSubscription -SubscriptionName $SourceSubscriptionName
    
    # Pick desired restore point using RestorePointCreationDate "xx/xx/xxxx xx:xx:xx xx"
    $PointInTime="<RestorePointCreationDate>"
    # Or list all restore points
    Get-AzSqlDatabaseRestorePoint -ResourceGroupName $SourceResourceGroupName -ServerName $SourceServerName -DatabaseName $SourceDatabaseName
    
    # Get the specific database to restore
    $Database = Get-AzSqlDatabase -ResourceGroupName $SourceResourceGroupName -ServerName $SourceServerName -DatabaseName $SourceDatabaseName
    
    # Switch context to the destination subscription
    Select-AzSubscription -SubscriptionName $TargetSubscriptionName
    
    # Restore database from a desired restore point of the source database to the target server in the desired subscription
    $RestoredDatabase = Restore-AzSqlDatabase –FromPointInTimeBackup –PointInTime $PointInTime -ResourceGroupName $TargetResourceGroupName -ServerName $TargetServerName -TargetDatabaseName $TargetDatabaseName –ResourceId $Database.ResourceID
    
    # Verify the status of restored database
    $RestoredDatabase.status