既存の専用 SQL プールを復元する

この記事では、Azure portal、Synapse Studio、PowerShell を使用して Azure Synapse Analytics で既存の専用 SQL プールを復元する方法について説明します。 この記事は、復元と geo リストアの両方に適用されます。

Note

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

Synapse Studio を使用して既存の専用 SQL プールを復元する

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

  2. ご利用の Azure Synapse ワークスペースに移動します。

  3. [はじめに] ->[Open Synapse Studio](Synapse Studio を開く) で、[開く] を選択します。 Screenshot from Synapse Studio, showing the Open Synapse Studio box and Open link.

  4. 左側のナビゲーション ウィンドウで、 [データ] を選択します。

  5. [プールを管理する] を選択します。

  6. [+ 新規] を選択して、Azure Synapse Analytics ワークスペースに新しい専用 SQL プールを作成します。

  7. [追加設定] タブで、復元する [復元ポイント] を選択します。

    geo リストアを実行する場合は、回復するワークスペースと専用 SQL プールを選択します。

  8. [自動復元ポイント] または [ユーザー定義の復元ポイント] を選択します。

    Screenshot from the Azure portal, Create SQL pool page, Additional settings page. For Restore point type, the Automatic restore points radio button is selected.

    • 専用 SQL プールに自動復元ポイントがない場合は、数時間待つか、復元する前にユーザー定義の復元ポイントを作成します。 ユーザー定義の復元ポイントを使用する場合は、既存のものを選択するか、新しく作成します。

    • 別のワークスペースから専用 SQL プールを復元する場合は、現在のワークスペースから [新しい専用 SQL プール] を選択します。 [追加設定] タブで、[既存のデータを使用する] を見つけて、[復元ポイント] オプションを選択します。 上のスクリーンショットに示すように、復元元のサーバーまたはワークスペースの名前を選択できます。

    • geo バックアップを復元する場合は、復元するソース リージョンにあるワークスペースと専用 SQL プールを選択します。

    Note

    既存のプールと同じ名前の SQL プールのインプレース リストアを実行することはできません。 SQL プールが同じワークスペースにあるか、別のワークスペースにあるかは関係ありません。

  9. [確認および作成] を選択します。

Azure portal を使用して既存の専用 SQL プールを復元する

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

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

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

    Screenshot from the Azure portal, showing the SQL pool overview page. The Restore button is highlighted.

  4. [自動復元ポイント] または [ユーザー定義の復元ポイント] を選択します。

    専用 SQL プールに自動復元ポイントがない場合は、数時間待つか、復元する前にユーザー定義の復元ポイントを作成します。

    geo リストアを実行する場合は、回復するワークスペースと専用 SQL プールを選択します。

  5. [確認および作成] を選択します。

PowerShell を使用して既存の専用 SQL プールを復元する

  1. PowerShell ターミナルを開きます。

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

  3. 復元する SQL プールが含まれるサブスクリプションを選択します。

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

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

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

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

    
    $SubscriptionName="<YourSubscriptionName>"
    $ResourceGroupName="<YourResourceGroupName>"
    $WorkspaceName="<YourWorkspaceNameWithoutURLSuffixSeeNote>"  # Without sql.azuresynapse.net
    #$TargetResourceGroupName="<YourTargetResourceGroupName>" # uncomment to restore to a different workspace.
    #$TargetWorkspaceName="<YourtargetWorkspaceNameWithoutURLSuffixSeeNote>"  
    $SQLPoolName="<YourDatabaseName>"
    $NewSQLPoolName="<YourDatabaseName>"
    
    Connect-AzAccount
    Get-AzSubscription
    Select-AzSubscription -SubscriptionName $SubscriptionName
    
    # list all restore points
    Get-AzSynapseSqlPoolRestorePoint -ResourceGroupName $ResourceGroupName -WorkspaceName $WorkspaceName -Name $SQLPoolName
    # Pick desired restore point using RestorePointCreationDate "xx/xx/xxxx xx:xx:xx xx"
    $PointInTime="<RestorePointCreationDate>"
    
    # Get the specific SQL pool to restore
    $SQLPool = Get-AzSynapseSqlPool -ResourceGroupName $ResourceGroupName -WorkspaceName $WorkspaceName -Name $SQLPoolName
    # Transform Synapse SQL pool resource ID to SQL database ID because currently the restore command only accepts the SQL database ID format.
    $DatabaseID = $SQLPool.Id -replace "Microsoft.Synapse", "Microsoft.Sql" `
        -replace "workspaces", "servers" `
        -replace "sqlPools", "databases"
    
    # Restore database from a restore point
    $RestoredDatabase = Restore-AzSynapseSqlPool –FromRestorePoint -RestorePoint $PointInTime -ResourceGroupName $SQLPool.ResourceGroupName `
        -WorkspaceName $SQLPool.WorkspaceName -TargetSqlPoolName $NewSQLPoolName –ResourceId $DatabaseID -PerformanceLevel DW100c
    
    # Use the following command to restore to a different workspace
    #$TargetResourceGroupName = $SQLPool.ResourceGroupName # for restoring to different workspace in same resourcegroup 
    #$RestoredDatabase = Restore-AzSynapseSqlPool –FromRestorePoint -RestorePoint $PointInTime -ResourceGroupName $TargetResourceGroupName `
    #    -WorkspaceName $TargetWorkspaceName -TargetSqlPoolName $NewSQLPoolName –ResourceId $DatabaseID -PerformanceLevel DW100c
    
    # Verify the status of restored database
    $RestoredDatabase.status
    

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

サブスクリプション間での復元を実行する場合、Azure Synapse ワークスペースの専用 SQL プールは、スタンドアロンの専用 SQL プール (旧称 SQL DW) にのみ直接復元できます。 Azure Synapse ワークスペースの専用 SQL プールを変換先サービスのワークスペースに復元する必要がある場合は、追加の復元手順が必要となります。

次の PowerShell の例は前の例と似ていますが、主に 3 つの違いがあります。

  • 復元する SQL プール オブジェクトを取得した後に、サブスクリプション コンテキストをターゲット サブスクリプション名に切り替える必要があります。
  • 復元を実行するときは、Az.Synapse モジュールではなく Az.Sql モジュールを使用します。
  • 次のサンプル コードには、変換先サービスの Azure Synapse ワークスペースに復元するための追加の手順が含まれています。 サンプルの説明に従って、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. 復元する SQL プールが含まれるサブスクリプションを選択します。

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

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

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

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

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

  10. 目的のターゲットが Synapse ワークスペースの場合は、追加の復元手順を実行するコードをコメント解除します。

    1. 新しく作成されたデータ ウェアハウスの復元ポイントを作成します。

    2. Select -Last 1 構文を使用して作成された最後の復元ポイントを取得します。

    3. 目的の Azure Synapse ワークスペースへの復元を実行します。

      $SourceSubscriptionName="<YourSubscriptionName>"
      $SourceResourceGroupName="<YourResourceGroupName>"
      $SourceWorkspaceName="<YourServerNameWithoutURLSuffixSeeNote>"  # Without sql.azuresynapse.net
      $SourceSQLPoolName="<YourDatabaseName>"
      $TargetSubscriptionName="<YourTargetSubscriptionName>"
      $TargetResourceGroupName="<YourTargetResourceGroupName>"
      $TargetServerName="<YourTargetServerNameWithoutURLSuffixSeeNote>"  # Without sql.azuresynapse.net
      $TargetDatabaseName="<YourDatabaseName>"
      #$TargetWorkspaceName="<YourTargetWorkspaceName>" # uncomment if restore to an Azure Synapse workspace is required
      
      # 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
      
      # list all restore points
      Get-AzSynapseSqlPoolRestorePoint -ResourceGroupName $SourceResourceGroupName -WorkspaceName $SourceWorkspaceName -Name $SourceSQLPoolName
      # Pick desired restore point using RestorePointCreationDate "xx/xx/xxxx xx:xx:xx xx"
      $PointInTime="<RestorePointCreationDate>"
      
      # Get the specific SQL pool to restore
      $SQLPool = Get-AzSynapseSqlPool -ResourceGroupName $SourceResourceGroupName -WorkspaceName $SourceWorkspaceName -Name $SourceSQLPoolName
      # Transform Synapse SQL pool resource ID to SQL database ID because currently the restore command only accepts the SQL database ID format.
      $DatabaseID = $SQLPool.Id -replace "Microsoft.Synapse", "Microsoft.Sql" `
          -replace "workspaces", "servers" `
          -replace "sqlPools", "databases"
      
      # 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 $DatabaseID
      
      # Verify the status of restored database
      $RestoredDatabase.status
      
      # uncomment below cmdlets to perform one more restore to push the SQL Pool to an existing workspace in the destination subscription
      # # Create restore point
      # New-AzSqlDatabaseRestorePoint -ResourceGroupName $RestoredDatabase.ResourceGroupName -ServerName $RestoredDatabase.ServerName `
      #     -DatabaseName $RestoredDatabase.DatabaseName -RestorePointLabel "UD-001"
      # # Gets the last restore point of the sql dw (will use the RestorePointCreationDate property)
      # $RestorePoint = Get-AzSqlDatabaseRestorePoint -ResourceGroupName $RestoredDatabase.ResourceGroupName -ServerName $RestoredDatabase.ServerName `
      #     -DatabaseName $RestoredDatabase.DatabaseName | Select -Last 1
      # # Restore to destination synapse workspace
      # $FinalRestore = Restore-AzSynapseSqlPool –FromRestorePoint -RestorePoint $RestorePoint.RestorePointCreationDate -ResourceGroupName $TargetResourceGroupName `
      #     -WorkspaceName $TargetWorkspaceName -TargetSqlPoolName $TargetDatabaseName –ResourceId $RestoredDatabase.ResourceID -PerformanceLevel DW100c
      
      

トラブルシューティング

復元操作の結果、"RequestTimeout" 例外によるデプロイ エラーが発生する場合があります。

Screenshot from resource group deployments dialog of a timeout exception.

このタイムアウトは無視してかまいません。 Azure portal の専用 [SQL プール] ページを確認すると、状態は "復元中" のままの場合がありますが、最終的には "オンライン" に切り替わります。

Screenshot of SQL pool dialog with the status that shows restoring.