기존 전용 SQL 풀 복원

이 문서에서는 Azure Portal, Synapse Studio, PowerShell을 사용하여 Azure Synapse Analytics에서 기존 전용 SQL 풀을 복원하는 방법을 알아봅니다. 이 문서는 복원 및 지역 복원 모두에 적용됩니다.

참고 항목

이 지침은 Azure Synapse 작업 영역의 전용 SQL 풀에만 적용됩니다. 독립 실행형 전용 SQL 풀(이전의 SQL DW)의 경우 기존 전용 SQL 풀(이전의 SQL DW) 복원을 참조하세요.

Synapse Studio를 통해 기존 전용 SQL 풀 복원

  1. Azure Portal에 로그인합니다.

  2. Azure Synapse 작업 영역으로 이동합니다.

  3. 시작 ->Synapse Studio 열기에서 열기를 선택합니다. Screenshot from Synapse Studio, showing the Open Synapse Studio box and Open link.

  4. 왼쪽의 탐색 창에서 데이터를 선택합니다.

  5. 풀 관리를 선택합니다.

  6. + 새로 만들기를 선택하여 Azure Synapse Analytics 작업 영역에서 새 전용 SQL 풀을 만듭니다.

  7. 추가 설정 탭에서 복원할 복원 지점을 선택합니다.

    지역 복원을 수행하려면 복구할 작업 영역과 전용 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 풀을 선택합니다. 추가 설정 탭에서 기존 데이터 사용을 찾아 복원 지점 옵션을 선택합니다. 위의 스크린샷에 표시된 것처럼 복원할 수 있는 서버 또는 작업 영역 이름을 선택할 수 있습니다.

    • 지역 백업을 복원하는 경우 원본 지역에 있는 작업 영역과 복원하려는 전용 SQL 풀을 선택합니다.

    참고 항목

    기존 풀과 이름이 같은 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 풀에 자동 복원 지점이 없는 경우 복원하기 전에 몇 시간 동안 기다리거나 사용자 정의 복원 지점을 만듭니다.

    지역 복원을 수행하려면 복구할 작업 영역과 전용 SQL 풀을 선택합니다.

  5. 검토 + 생성를 선택합니다.

PowerShell을 통해 기존 전용 SQL 풀 복원

  1. PowerShell 터미널을 엽니다.

  2. Azure 계정에 연결하고 사용자 계정과 연결된 모든 구독을 나열합니다.

  3. 복원할 SQL 풀이 포함된 구독을 선택합니다.

  4. 전용 SQL 풀의 복원 지점을 나열합니다.

  5. RestorePointCreationDate를 사용하여 원하는 복원 지점을 선택합니다.

  6. Restore-AzSqlDatabase PowerShell cmdlet을 사용하여 전용 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 예제는 이전과 유사하지만 세 가지 주요 차이점이 있습니다.

  • 복원할 SQL 풀 개체를 검색한 후 구독 컨텍스트를 대상 구독 이름으로 전환해야 합니다.
  • 복원을 수행할 때 Az.Synapse 모듈 대신 Az.Sql 모듈을 사용합니다.
  • 아래 샘플 코드에는 대상 구독의 Azure Synapse 작업 영역으로 복원하기 위한 추가 단계가 있습니다. 샘플에서 설명한 대로 PowerShell 명령의 주석 처리를 제거합니다.

단계:

  1. PowerShell 터미널을 엽니다.

  2. Update-Module을 사용하는 이전 버전인 경우 Az.Sql Module을 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 cmdlet을 사용하여 전용 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.