还原现有专用 SQL 池(以前称为 SQL DW)Restore an existing dedicated SQL pool (formerly SQL DW)

本文介绍如何通过 Azure 门户和 PowerShell 还原现有专用 SQL 池(之前称为 SQL DW)。In this article, you learn how to restore an existing dedicated SQL pool (formerly SQL DW) using Azure portal and PowerShell.

备注

本文进行了更新,以便使用新的 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. 每个池都由一个具有默认 DTU 配额的逻辑 SQL server(例如 myserver.database.chinacloudapi.cn)托管。Each pool is hosted by a logical SQL server (for example, myserver.database.chinacloudapi.cn) which has a default DTU quota. 验证该服务器的剩余 DTU 配额是否足够进行数据库还原。Verify the server has enough remaining DTU quota for the database being restored.

准备阶段Before you begin

  1. 确保安装 Azure PowerShellMake sure to install Azure PowerShell.
  2. 有一个现有的还原点,需要从该点进行还原。Have an existing restore point that you want to restore from. 若要创建新的还原,请参阅教程:新建用户定义的还原点If you want to create a new restore, see the tutorial to create a new user-defined restore point.

通过 PowerShell 还原现有专用 SQL 池(之前称为 SQL DW)Restore an existing dedicated SQL pool (formerly SQL DW) through PowerShell

若要从还原点还原现有专用 SQL 池(之前称为 SQL DW),请使用 Restore-AzSqlDatabase PowerShell cmdlet。To restore an existing dedicated SQL pool (formerly SQL DW) from a restore point use the Restore-AzSqlDatabase PowerShell cmdlet.

  1. 打开 PowerShell。Open PowerShell.

  2. 连接到 Azure 帐户,并列出与帐户关联的所有订阅。Connect to your Azure account and list all the subscriptions associated with your account.

  3. 选择包含要还原的数据库的订阅。Select the subscription that contains the database to be restored.

  4. 列出专用 SQL 池(之前称为 SQL DW)的还原点。List the restore points for the dedicated SQL pool (formerly SQL DW).

  5. 使用 RestorePointCreationDate 选取所需的还原点。Pick the desired restore point using the RestorePointCreationDate.

  6. 使用 Restore-AzSqlDatabase PowerShell cmdlet 将专用 SQL 池(之前称为 SQL DW)还原到所需还原点。Restore the dedicated SQL pool (formerly SQL DW) to the desired restore point using Restore-AzSqlDatabase PowerShell cmdlet.

    • 若要将专用 SQL 池(以前称为 SQL DW)还原到另一服务器,请确保指定其他服务器名称。To restore the dedicated SQL pool (formerly SQL DW) to a different server, make sure to specify the other server name. 该服务器也可以位于另一资源组和区域中。This server can also be in a different resource group and region.
  7. 验证已还原的专用 SQL 池(之前称为 SQL DW)是否处于联机状态。Verify that the restored dedicated SQL pool (formerly SQL DW) is online.

  8. 完成还原后,即可按在恢复后配置数据库中的说明配置恢复的专用 SQL 池(之前称为 SQL DW)。After the restore has completed, you can configure your recovered dedicated SQL pool (formerly SQL DW) by following configure your database after recovery.


$SubscriptionName="<YourSubscriptionName>"
$ResourceGroupName="<YourResourceGroupName>"
$ServerName="<YourServerNameWithoutURLSuffixSeeNote>"  # Without database.chinacloudapi.cn
#$TargetResourceGroupName="<YourTargetResourceGroupName>" # uncomment to restore to a different server.
#$TargetServerName="<YourtargetServerNameWithoutURLSuffixSeeNote>"  
$DatabaseName="<YourDatabaseName>"
$NewDatabaseName="<YourDatabaseName>"

Connect-AzAccount -Environment AzureChinaCloud
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 门户还原现有专用 SQL 池(之前称为 SQL DW)Restore an existing dedicated SQL pool (formerly SQL DW) through the Azure portal

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 导航到要从其进行还原的专用 SQL 池。Navigate to the dedicated that you want to restore from.

  3. 在“概览”边栏选项卡顶部,选择“还原”。At the top of the Overview blade, select Restore.

     还原概述Restore Overview

  4. 选择“自动还原点”或“用户定义的还原点”。 Select either Automatic Restore Points or User-Defined Restore Points. 如果专用 SQL 池(之前称为 SQL DW)没有任何自动还原点,请等待数小时或创建一个用户定义的还原点,然后再进行还原。If the dedicated SQL pool (formerly SQL DW) doesn't have any automatic restore points, wait a few hours or create a user defined restore point before restoring. 对于用户定义的还原点,请选择一个现有的,或者创建一个新的。For User-Defined Restore Points, select an existing one or create a new one. 对于“服务器”,可以选取另一资源组和区域中的服务器,也可以创建一个新服务器。For Server, you can pick a server in a different resource group and region or create a new one. 在提供所有参数后,请单击“查看 + 还原”。After providing all the parameters, click Review + Restore.

    自动还原点

后续步骤Next Steps