SQL 池的异地还原Geo-restore for SQL pool

本文介绍了如何通过 Azure 门户和 PowerShell 从异地备份还原 SQL 池。In this article, you learn to restore your SQL pool from a geo-backup through Azure portal and PowerShell.

准备阶段Before you begin


本文进行了更新,以便使用新的 Azure PowerShell Az 模块。This article has been updated to use the new Azure PowerShell Az module. 你仍然可以使用 AzureRM 模块,至少在 2020 年 12 月之前,它将继续接收 bug 修补程序。You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. 若要详细了解新的 Az 模块和 AzureRM 兼容性,请参阅新 Azure Powershell Az 模块简介To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. 有关 Az 模块安装说明,请参阅安装 Azure PowerShellFor Az module installation instructions, see Install Azure PowerShell.

验证 DTU 容量。Verify your DTU capacity. 每个 SQL 池都由一个具有默认 DTU 配额的逻辑 SQL Server(例如 myserver.database.chinacloudapi.cn)托管。Each SQL pool is hosted by a logical SQL server (for example, myserver.database.chinacloudapi.cn) which has a default DTU quota. 验证 SQL Server 的剩余 DTU 配额是否足够进行数据库还原。Verify that the SQL server has enough remaining DTU quota for the database being restored.

通过 PowerShell 从 Azure 地理区域还原Restore from an Azure geographical region through PowerShell

若要从异地备份还原,请使用 Get-AzSqlDatabaseGeoBackupRestore-AzSqlDatabase cmdlet。To restore from a geo-backup, use the Get-AzSqlDatabaseGeoBackup and Restore-AzSqlDatabase cmdlet.


可以执行到第 2 代的异地还原!You can perform a geo-restore to Gen2! 若要执行此操作,请将一个第 2 代 ServiceObjectiveName(例如 DW1000c)指定为可选参数。To do so, specify an Gen2 ServiceObjectiveName (e.g. DW1000c) as an optional parameter.

  1. 开始之前,请确保安装 Azure PowerShellBefore you begin, make sure to install Azure PowerShell.
  2. 打开 PowerShell。Open PowerShell.
  3. 连接到 Azure 帐户,并列出与帐户关联的所有订阅。Connect to your Azure account and list all the subscriptions associated with your account.
  4. 选择包含要还原的数据仓库的订阅。Select the subscription that contains the data warehouse to be restored.
  5. 获取要恢复的数据仓库。Get the data warehouse you want to recover.
  6. 创建对数据仓库的恢复请求。Create the recovery request for the data warehouse.
  7. 验证异地还原的数据仓库的状态。Verify the status of the geo-restored data warehouse.
  8. 若要在完成还原后配置数据仓库,请参阅在恢复后配置数据库To configure your data warehouse after the restore has completed, see Configure your database after recovery.
$ServerName="<YourServerNameWithoutURLSuffixSeeNote>"  # Without database.chinacloudapi.cn
$TargetResourceGroupName="<YourTargetResourceGroupName>" # Restore to a different server.

Connect-AzAccount -Environment AzureChinaCloud
Select-AzSubscription -SubscriptionName $SubscriptionName
Get-AzureSqlDatabase -ServerName $ServerName

# Get the data warehouse you want to recover
$GeoBackup = Get-AzSqlDatabaseGeoBackup -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName

# Recover data warehouse
$GeoRestoredDatabase = Restore-AzSqlDatabase –FromGeoBackup -ResourceGroupName $TargetResourceGroupName -ServerName $TargetServerName -TargetDatabaseName $NewDatabaseName –ResourceId $GeoBackup.ResourceID -ServiceObjectiveName $TargetServiceObjective

# Verify that the geo-restored data warehouse is online

如果源数据库启用了 TDE,则已恢复的数据库会启用 TDE。The recovered database will be TDE-enabled if the source database is TDE-enabled.

通过 Azure 门户从 Azure 地理区域还原Restore from an Azure geographical region through Azure portal

按下述步骤从异地备份还原 SQL 池:Follow the steps outlined below to restore a SQL pool from a geo-backup:

  1. 登录到 Azure 门户帐户。Sign in to your Azure portal account.

  2. 单击“+ 创建资源”。Click + Create a resource.

    新建 DW

  3. 依次单击“数据库”、“Azure Synapse Analytics”(以前称为“SQL DW”) 。Click Databases and then Azure Synapse Analytics (formerly SQL DW).

    新建 DW 2

  4. 填充在“基本信息”选项卡中请求的信息,然后单击“下一步:其他设置”。Fill out the information requested in the Basics tab and click Next: Additional settings.


  5. 对于“使用现有的数据”参数,请选择“备份”,然后从向下滚动选项中选择适当的备份。For Use existing data parameter, select Backup and select the appropriate backup from the scroll down options. 单击“查看 + 创建”。Click Review + Create.


  6. 数据仓库还原后,请检查“状态”是否为“联机”。Once the data warehouse has been restored, check that the Status is Online.

后续步骤Next Steps