Azure VM 中 SQL Server 的软删除和 Azure VM 工作负荷中 SAP HANA 的软删除Soft delete for SQL server in Azure VM and SAP HANA in Azure VM workloads

Azure 备份现在为 Azure VM 中的 SQL Server 和 Azure VM 工作负荷中的 SAP HANA 提供软删除。Azure Backup now provides soft delete for SQL server in Azure VM and SAP HANA in Azure VM workloads. 这是对已支持的 Azure 虚拟机软删除方案的补充。This is in addition to the already supported Azure Virtual machine soft delete scenario.

软删除是一项可帮助保护备份数据的安全功能,即使删除了备份数据,也能予以恢复。Soft delete is a security feature to help protect backup data even after deletion. 在使用软删除的情况下,即使恶意行动者删除了数据库的备份(或用户意外删除了备份数据),备份数据也会再保留 14 天。With soft delete, even if a malicious actor deletes the backup of a database (or backup data is accidentally deleted), the backup data is retained for 14 additional days. 这样就可以恢复该备份项,而不会丢失数据。This allows the recovery of that backup item with no data loss. 以“软删除”状态将备份数据额外保留 14 天不会向客户收取任何费用。This additional retention of 14 days of the backup data in the "soft delete" state doesn’t incur any cost to the customer.

使用 Azure 门户对 Azure VM 中的 SQL Server 进行软删除Soft delete for SQL server in Azure VM using Azure portal

备注

这些说明也适用于 Azure VM 中的 SAP HANA。These instructions also apply to SAP HANA in Azure VM.

  1. 若要删除 SQL Server 中数据库的备份数据,必须停止备份。To delete the backup data of a database in a SQL server, the backup must be stopped. 在 Azure 门户中,转到恢复服务保管库,转到备份项,然后选择“停止备份”。In the Azure portal, go to your Recovery Services vault, go to the backup item, and choose Stop backup.

    停止备份

  2. 在接下来的窗口中,会提供用于删除或保留备份数据的选项。In the following window, you'll be given a choice to delete or retain the backup data. 如果选择“删除备份数据”****,则不会永久删除数据库备份,If you choose Delete backup data, the database backup won't be permanently deleted. 而是将备份数据以软删除状态保留 14 天。Rather, the backup data will be retained for 14 days in the soft deleted state. 删除操作将延迟到第 15 天,并在第 1 天、第 12 天和第 15 天通过定期的警报电子邮件通知用户该数据库的备份状态。The deletion is deferred until the 15th day with regular alert emails on the first, 12th, and 15th day informing about the backup state of the database to the user.

    删除备份数据

  3. 在这 14 天内,恢复服务保管库中已软删除的项旁边会显示一个红色的“软删除”图标。During those 14 days, in the Recovery Services vault, the soft deleted item will appear with a red “soft-delete” icon next to it.

    已软删除的项

  4. 若要还原已软删除的 DB,必须先将其取消删除。To restore the soft-deleted DB, it must first be undeleted. 若要取消删除,请选择已软删除的 DB,然后选择“取消删除”选项****。To undelete, choose the soft-deleted DB, and then select the option Undelete.

    取消删除数据库

    窗口中会显示一条警告,指出如果选择取消删除,将取消删除数据库的所有还原点,这些还原点可用于执行还原操作。A window will appear warning that if undelete is chosen, all restore points for the database will be undeleted and available for performing a restore operation. 备份项将保留为“停止保护并保留数据”状态,备份将会暂停,备份数据将永久保留,且没有任何生效的备份策略。The backup item will be retained in a “stop protection with retain data” state with backups paused and backup data retained forever with no backup policy effective.

    取消删除警告

  5. 此时,还可以通过从已软删除的选定备份项中选择“还原”来还原数据****。At this point, you can also restore the data by selecting Restore for the chosen soft deleted backup item.

    还原 VM

  6. 取消删除操作完成后,状态将恢复为“停止备份并保留数据”,然后,你可以选择“恢复备份”。****After the undelete process is completed, the status will return to “Stop backup with retain data” and then you can choose Resume backup. “恢复备份”操作会恢复处于活动状态的、与定义备份和保留计划的用户所选的备份策略相关联的备份项。****The Resume backup operation brings back the backup item in the active state, associated with a backup policy selected by the user defining the backup and retention schedules.

    恢复备份

使用 Azure PowerShell 对 VM 中的 SQL Server 进行软删除Soft delete for SQL server in VM using Azure PowerShell

备注

使用 Azure PowerShell 进行软删除所需的 Az.RecoveryServices 版本最低为 2.2.0。The Az.RecoveryServices version required to use soft-delete using Azure PowerShell is minimum 2.2.0. 可使用 Install-Module -Name Az.RecoveryServices -Force 获取最新版本。Use Install-Module -Name Az.RecoveryServices -Force to get the latest version.

使用 Azure PowerShell 的步骤顺序与上面概述的 Azure 门户中的步骤顺序相同。The sequence of steps for using Azure PowerShell is the same as in the Azure portal, outlined above.

使用 Azure PowerShell 删除备份项Delete the backup item using Azure PowerShell

使用 Disable-AzRecoveryServicesBackupProtection PowerShell cmdlet 删除备份项。Delete the backup item using the Disable-AzRecoveryServicesBackupProtection PowerShell cmdlet.

Disable-AzRecoveryServicesBackupProtection -Item $myBkpItem -RemoveRecoveryPoints -VaultId $myVaultID -Force

备份项的“DeleteState”**** 将从“NotDeleted”**** 更改为“ToBeDeleted”****。The DeleteState of the backup item will change from NotDeleted to ToBeDeleted. 备份数据会保留 14 天。The backup data will be retained for 14 days. 如果要还原删除操作,则应执行撤消-删除操作。If you wish to revert the delete operation, then undo-delete should be performed.

使用 Azure PowerShell 撤销删除操作Undoing the deletion operation using Azure PowerShell

首先,提取处于软删除状态(也就是即将删除)的相关备份项。First, fetch the relevant backup item that's in soft-delete state (that is, about to be deleted).

Get-AzRecoveryServicesBackupItem -BackupManagementType AzureWorkload -WorkloadType SQLDataBase -VaultId $myVaultID | Where-Object {$_.DeleteState -eq "ToBeDeleted"}

$myBkpItem = Get-AzRecoveryServicesBackupItem -BackupManagementType AzureWorkload -WorkloadType SQLDataBase -VaultId $myVaultID -Name AppVM1

然后,使用 Undo-AzRecoveryServicesBackupItemDeletion PowerShell cmdlet 执行撤消删除操作。Then, perform the undo-deletion operation using the Undo-AzRecoveryServicesBackupItemDeletion PowerShell cmdlet.

Undo-AzRecoveryServicesBackupItemDeletion -Item $myBKpItem -VaultId $myVaultID -Force

备份项的“DeleteState”**** 将还原为“NotDeleted”****。The DeleteState of the backup item will revert to NotDeleted. 但保护仍处于停止状态。But the protection is still stopped. 恢复备份以重新启用保护。Resume the backup to re-enable the protection.

如何禁用软删除How to disable soft delete

建议不要禁用此功能。Disabling this feature isn't recommended. 唯一应该考虑禁用软删除的情况是,你打算将受保护的项移到新保管库,需要在删除后重新进行保护,因此等不及要求的 14 天(例如在测试环境中)。有关如何禁用软删除的说明,请参阅启用和禁用软删除The only circumstance where you should consider disabling soft delete is if you're planning on moving your protected items to a new vault, and can't wait the 14 days required before deleting and reprotecting (such as in a test environment.) For instructions on how to disable soft delete, see Enabling and disabling soft delete.

后续步骤Next steps