管理和监视已备份的 SQL Server 数据库Manage and monitor backed up SQL Server databases

本文介绍对 Azure 虚拟机 (VM) 上运行的、已通过 Azure 备份服务备份到 Azure 备份恢复服务保管库的 SQL Server 数据库进行管理和监视所要执行的常见任务。This article describes common tasks for managing and monitoring SQL Server databases that are running on an Azure virtual machine (VM) and that are backed up to an Azure Backup Recovery Services vault by the Azure Backup service. 其中将会介绍如何监视作业和警报、停止和恢复数据库保护、运行备份作业,以及从备份中取消注册 VM。You'll learn how to monitor jobs and alerts, stop and resume database protection, run backup jobs, and unregister a VM from backups.

如果尚未为 SQL Server 数据库配置备份,请参阅备份 Azure VM 上的 SQL Server 数据库If you haven't yet configured backups for your SQL Server databases, see Back up SQL Server databases on Azure VMs

在门户中监视手动备份作业Monitor manual backup jobs in the portal

Azure 备份在“备份作业”门户中显示所有手动触发的作业。 Azure Backup shows all manually triggered jobs in the Backup jobs portal. 此门户中显示的作业包括数据库发现和注册,以及备份和还原操作。The jobs you see in this portal include database discovery and registering, and backup and restore operations.

“备份作业”门户

Note

“备份作业”门户不显示计划的备份作业。 The Backup jobs portal doesn't show scheduled backup jobs. 可按下一部分所述,使用 SQL Server Management Studio 来监视计划的备份作业。Use SQL Server Management Studio to monitor scheduled backup jobs, as described in the next section.

有关监视方案的详细信息,请参阅在 Azure 门户中进行监视使用 Azure Monitor 进行监视For details on Monitoring scenarios, go to Monitoring in the Azure portal and Monitoring using Azure Monitor.

查看备份警报View backup alerts

由于日志备份每隔 15 分钟就会发生一次,因此,监视备份作业可能很繁琐。Because log backups occur every 15 minutes, monitoring backup jobs can be tedious. Azure 备份通过发送电子邮件警报来简化监视工作。Azure Backup eases monitoring by sending email alerts. 电子邮件警报:Email alerts are:

  • 只要出现备份失败就会触发。Triggered for all backup failures.
  • 在数据库级别按错误代码进行合并。Consolidated at the database level by error code.
  • 仅在数据库首次备份失败时发送。Sent only for a database's first backup failure.

若要监视数据库备份警报:To monitor database backup alerts:

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

  2. 在保管库仪表板中,选择“警报和事件”。 On the vault dashboard, select Alerts and Events.

    选择“警报和事件”

  3. 在“警报和事件” 中,选择“备份警报” 。In Alerts and Events, select Backup Alerts.

    选择“备份警报”

停止 SQL Server 数据库的保护Stop protection for a SQL Server database

可以通过两种方式来停止备份 SQL Server 数据库:You can stop backing up a SQL Server database in a couple of ways:

  • 停止所有将来的备份作业,并删除所有恢复点。Stop all future backup jobs, and delete all recovery points.
  • 停止所有将来的备份作业,但将恢复点保留不变。Stop all future backup jobs, and leave the recovery points intact.

如果选择保留恢复点,请注意以下细节:If you choose to leave recovery points, keep these details in mind:

  • 所有恢复点永远保留不变,在停止保护时所有修剪操作都会停止,但会保留数据。All recovery points will remain intact forever, all pruning shall stop at stop protection with retain data.
  • 需要为受保护的实例和消耗的存储空间付费。You will be charged for the protected instance and the consumed storage. 有关详细信息,请参阅 Azure 备份定价For more information, see Azure Backup pricing.
  • 如果在不停止备份的情况下删除数据源,则新备份将会失败。If you delete a data source without stopping backups, new backups will fail.

停止数据库的保护:To stop protection for a database:

  1. 在保管库仪表板中,选择“备份项”。 On the vault dashboard, select Backup Items.

  2. 在“备份管理类型”下,选择“Azure VM 中的 SQL”。 Under Backup Management Type, select SQL in Azure VM.

    选择“Azure VM 中 SQL”

  3. 选择要停止保护的数据库。Select the database for which you want to stop protection.

    选择要停止保护的数据库

  4. 在数据库菜单中,选择“停止备份” 。On the database menu, select Stop backup.

    选择“停止备份”

  5. 在“停止备份”菜单中,选择是要保留还是删除数据。 On the Stop Backup menu, select whether to retain or delete data. 根据需要提供原因和注释。If you want, provide a reason and comment.

    在“停止备份”菜单中保留或删除数据

  6. 选择“停止备份”。 Select Stop backup.

恢复 SQL 数据库的保护Resume protection for a SQL database

停止对 SQL 数据库的保护时,如果选择“保留备份数据”选项,以后可以恢复保护。 When you stop protection for the SQL database, if you select the Retain Backup Data option, you can later resume protection. 如果不保留备份数据,则无法恢复保护。If you don't retain the backup data, you can't resume protection.

若要恢复 SQL 数据库的保护:To resume protection for a SQL database:

  1. 打开备份项,并选择“恢复备份”。 Open the backup item and select Resume backup.

    选择“恢复备份”以恢复数据库保护

  2. 在“备份策略”菜单中选择策略,然后选择“保存”。 On the Backup policy menu, select a policy, and then select Save.

运行按需备份Run an on-demand backup

你可以运行不同类型的按需备份:You can run different types of on-demand backups:

  • 完整备份Full backup
  • 仅复制完整备份Copy-only full backup
  • 差异备份Differential backup
  • 日志备份Log backup

需要指定“仅限复制的完整备份”的保留期,而临时完整备份的保留期将自动设置为从当前时间算起的 45 天。While you need to specify the retention duration for Copy-only full backup, the retention range for ad-hoc full backup will automatically be set to 45 days from current time.

有关详细信息,请参阅 SQL Server 备份类型For more information, see SQL Server backup types.

取消注册 SQL Server 实例Unregister a SQL Server instance

在禁用保护之后但删除保管库之前取消注册 SQL Server 实例:Unregister a SQL Server instance after you disable protection but before you delete the vault:

  1. 在保管库仪表板上,在“管理”下,选择“备份基础结构”。 On the vault dashboard, under Manage, select Backup Infrastructure.

    选择“备份基础结构”。

  2. 在“管理服务器”下,选择“受保护的服务器”。 Under Management Servers, select Protected Servers.

    选择“受保护的服务器”

  3. 在“受保护的服务器”中,选择要取消注册的服务器。 In Protected Servers, select the server to unregister. 若要删除保管库,必须取消注册所有服务器。To delete the vault, you must unregister all servers.

  4. 右键单击受保护的服务器并选择“取消注册”。 Right-click the protected server, and select Unregister.

    选择“删除”

修改策略Modify policy

修改策略可以更改备份频率或保留范围。Modify policy to change backup frequency or retention range.

Note

在保留期内进行的任何更改将应用到新恢复点,并以追溯方式应用到所有旧恢复点。Any change in the retention period will be applied retrospectively to all the older recovery points besides the new ones.

在保管库仪表板中,转到“管理” > “备份策略”,然后选择要编辑的策略。 In the vault dashboard, go to Manage > Backup Policies and choose the policy you want to edit.

管理备份策略

修改备份策略

策略修改将影响所有关联的备份项,并触发相应的配置保护作业。Policy modification will impact all the associated Backup Items and trigger corresponding configure protection jobs.

不一致的策略Inconsistent Policy

有时,修改策略操作可能导致某些备份项出现不一致的策略版本。Sometimes, a modify policy operation can lead to an inconsistent policy version for some backup items. 如果在触发修改策略操作后对备份项执行相应的配置保护作业失败,则会出现这种不一致。This happens when the corresponding configure protection job fails for the backup item after a modify policy operation is triggered. 这种情况会反映在备份项视图中,如下所示:It appears as follows in the backup item view:

不一致的策略

只需单击一下鼠标即可修复所有受影响项的策略版本:You can fix the policy version for all the impacted items in one click:

修复不一致的策略

重新注册 SQL Server VM 上的扩展Re-register extension on the SQL Server VM

有时,不同的原因会影响 VM 上的工作负荷扩展。Sometimes, the workload extension on the VM may get impacted for one reason or the other. 在这种情况下,在该 VM 上触发的所有操作将开始失败。In such cases, all the operations triggered on the VM will begin to fail. 然后,可能需要在 VM 上重新注册该扩展。You may then need to re-register the extension on the VM. 重新注册操作会在 VM 上重新安装工作负荷备份扩展,使操作能够继续。Re-register operation reinstalls the workload backup extension on the VM for operations to continue.

请慎用此选项;如果在包含正常扩展的 VM 上触发此操作,将导致扩展重启,Use this option with caution; when triggered on a VM with an already healthy extension, this operation will cause the extension to get restarted. 从而可能导致所有正在进行的作业失败。This may result in all the in-progress jobs to fail. 在触发重新注册操作之前,请检查是否存在这些症状Kindly check for one or more of the symptoms before triggering the re-register operation.

后续步骤Next steps

有关详细信息,请参阅排查 SQL Server 数据库备份问题For more information, see Troubleshoot backups on a SQL Server database.