使用 Azure Synapse Analytics 还原已删除的 SQL 池Restore a deleted SQL pool using Azure Synapse Analytics

本文介绍了如何使用 Azure 门户或 PowerShell 还原 SQL。In this article, you learn to restore a SQL using either the Azure portal or 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. 验证该服务器的剩余 DTU 配额是否足够进行数据库还原。Verify that the server has enough remaining DTU quota for the database being restored.

通过 PowerShell 还原已删除的数据仓库Restore a deleted data warehouse through PowerShell

若要还原已删除的 SQL 池,请使用 Restore-AzSqlDatabase cmdlet。To restore a deleted SQL pool, use the Restore-AzSqlDatabase cmdlet. 如果相应的服务器也已被删除,则不能还原该数据仓库。If the corresponding server has been deleted as well, you can't restore that data warehouse.

  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. 选择包含要还原的已删除 SQL 池的订阅。Select the subscription that contains the deleted SQL pool to be restored.
  5. 获取特定的已删除数据仓库。Get the specific deleted data warehouse.
  6. 还原已删除的 SQL 池Restore the deleted SQL pool
    • 若要将已删除的 SQL 池还原到另一服务器,请确保指定其他服务器名称。To restore the deleted SQL pool 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. 验证已还原的数据仓库是否处于联机状态。Verify that the restored data warehouse is online.
  8. 完成还原后,可以按在恢复后配置数据库中的说明配置恢复后的数据仓库。After the restore has completed, you can configure your recovered data warehouse 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

# Get the deleted database to restore
$DeletedDatabase = Get-AzSqlDeletedDatabaseBackup -ResourceGroupName $ResourceGroupName -ServerName $ServerName -DatabaseName $DatabaseName

# Restore deleted database
$RestoredDatabase = Restore-AzSqlDatabase –FromDeletedDatabaseBackup –DeletionDate $DeletedDatabase.DeletionDate -ResourceGroupName $DeletedDatabase.ResourceGroupName -ServerName $DeletedDatabase.ServerName -TargetDatabaseName $NewDatabaseName –ResourceId $DeletedDatabase.ResourceID

# Use the following command to restore deleted data warehouse to a different server
#$RestoredDatabase = Restore-AzSqlDatabase –FromDeletedDatabaseBackup –DeletionDate $DeletedDatabase.DeletionDate -ResourceGroupName $TargetResourceGroupName -ServerName $TargetServerName -TargetDatabaseName $NewDatabaseName –ResourceId $DeletedDatabase.ResourceID

# Verify the status of restored database
$RestoredDatabase.status

通过 Azure 门户还原已删除的数据库Restore a deleted database using the Azure portal

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

  2. 导航到承载着已删除数据仓库的服务器。Navigate to the server your deleted data warehouse was hosted on.

  3. 在目录中选择“已删除的数据库”图标。Select the Deleted databases icon in the table of contents.

    已删除的数据库

  4. 选择要还原的已删除 SQL 数据仓库。Select the deleted SQL Data Warehouse that you want to restore.

    选择“已删除的数据库”

  5. 指定新的数据库名称,并单击“确定”Specify a new Database name and click OK

    指定数据库名称

后续步骤Next Steps