从恢复服务保管库备份多个 SQL Server VMBack up multiple SQL Server VMs from the Recovery Services vault

SQL Server 数据库属于关键工作负荷,要求较低的恢复点目标 (RPO) 和长期保留。SQL Server databases are critical workloads that require a low recovery-point objective (RPO) and long-term retention. 可以使用 Azure 备份来备份 Azure 虚拟机 (VM) 上运行的 SQL Server 数据库。You can back up SQL Server databases running on Azure virtual machines (VMs) by using Azure Backup.

本文介绍如何将 Azure VM 上运行的 SQL Server 数据库备份到 Azure 备份恢复服务保管库。This article shows how to back up a SQL Server database that's running on an Azure VM to an Azure Backup Recovery Services vault.

本文介绍如何执行以下操作:In this article, you'll learn how to:

  • 创建并配置保管库。Create and configure a vault.
  • 发现数据库并设置备份。Discover databases and set up backups.
  • 为数据库设置自动保护。Set up auto-protection for databases.

备注

针对 Azure VM 中 SQL 服务器的软删除以及针对 Azure VM 工作负荷中 SAP HANA 的软删除现已推出预览版。Soft delete for SQL server in Azure VM and soft delete for SAP HANA in Azure VM workloads is now available in preview.

先决条件Prerequisites

在备份 SQL Server 数据库之前,请检查以下条件:Before you back up a SQL Server database, check the following criteria:

  1. 在托管 SQL Server 实例的 VM 所在的区域和订阅中标识或创建一个恢复服务保管库Identify or create a Recovery Services vault in the same region and subscription as the VM hosting the SQL Server instance.
  2. 验证 VM 是否已建立网络连接Verify that the VM has network connectivity.
  3. 确保 SQL Server 数据库遵循 Azure 备份的数据库命名准则Make sure that the SQL Server databases follow the database naming guidelines for Azure Backup.
  4. 对于 Azure 资源管理器 (ARM) VM,请确保 SQL Server VM 名称和资源组名称的组合长度不超过 84 个字符(对于经典 VM,则不超过 77 个字符)。Ensure that the combined length of the SQL Server VM name and the resource group name doesn't exceed 84 characters for Azure Resource Manager (ARM) VMs (or 77 characters for classic VMs). 此限制是因为某些字符由该服务预留。This limitation is because some characters are reserved by the service.
  5. 检查是否未为该数据库启用了其他任何备份解决方案。Check that you don't have any other backup solutions enabled for the database. 在备份数据库之前,请禁用其他所有 SQL Server 备份。Disable all other SQL Server backups before you back up the database.

备注

可以同时针对某个 Azure VM 以及该 VM 上运行的 SQL Server 数据库启用 Azure 备份,这不会发生冲突。You can enable Azure Backup for an Azure VM and also for a SQL Server database running on the VM without conflict.

建立网络连接Establish network connectivity

对于所有操作,SQL Server VM 需要连接到 Azure 备份服务、Azure 存储和 Azure Active Directory。For all operations, a SQL Server VM requires connectivity to the Azure Backup service, Azure Storage, and Azure Active Directory. 这可以通过使用专用终结点,或允许访问所需的公共 IP 地址或 FQDN 来实现。This can be achieved by using private endpoints or by allowing access to the required public IP addresses or FQDNs. 如果不允许正确连接到所需的 Azure 服务,则可能会导致诸如数据库发现、配置备份、执行备份和还原数据等操作失败。Not allowing proper connectivity to the required Azure services may lead to failure in operations like database discovery, configuring backup, performing backups, and restoring data.

下表列出了可用于建立连接的各种备选方案:The following table lists the various alternatives you can use for establishing connectivity:

选项Option 优点Advantages 缺点Disadvantages
专用终结点Private endpoints 允许通过虚拟网络中的专用 IP 进行备份Allow backups over private IPs inside the virtual network

提供网络和保管库端的精细控制Provide granular control on the network and vault side
产生标准专用终结点成本Incurs standard private endpoint costs
NSG 服务标记NSG service tags 由于范围更改会自动合并,因此管理变得更容易Easier to manage as range changes are automatically merged

无额外成本No additional costs
只可用于 NSGCan be used with NSGs only

提供对整个服务的访问Provides access to the entire service
Azure 防火墙 FQDN 标记Azure Firewall FQDN tags 自动管理必需的 FQDN,因此更易于管理Easier to manage since the required FQDNs are automatically managed 只可用于 Azure 防火墙Can be used with Azure Firewall only
允许访问服务 FQDN/IPAllow access to service FQDNs/IPs 无额外成本No additional costs

适用于所有网络安全设备和防火墙Works with all network security appliances and firewalls
可能需要访问一组广泛的 IP 或 FQDNA broad set of IPs or FQDNs may be required to be accessed
使用 HTTP 代理Use an HTTP proxy 对 VM 进行单点 Internet 访问Single point of internet access to VMs 通过代理软件运行 VM 带来的额外成本Additional costs to run a VM with the proxy software

关于使用这些选项的更多细节如下:More details around using these options are shared below:

专用终结点Private endpoints

使用专用终结点,可以从虚拟网络内的服务器安全地连接到恢复服务保管库。Private endpoints allow you to connect securely from servers inside a virtual network to your Recovery Services vault. 专用终结点为保管库使用 VNET 地址空间中的 IP。The private endpoint uses an IP from the VNET address space for your vault. 虚拟网络中的资源与保管库之间的网络流量将通过虚拟网络和 Microsoft 主干网络上的专用链接传输。The network traffic between your resources inside the virtual network and the vault travels over your virtual network and a private link on the Microsoft backbone network. 这样就不会从公共 Internet 泄露信息。This eliminates exposure from the public internet. 此处详细了解 Azure 备份的专用终结点。Read more on private endpoints for Azure Backup here.

NSG 标记NSG tags

如果使用网络安全组 (NSG),请使用 AzureBackup 服务标记以允许对 Azure 备份进行出站访问。If you use Network Security Groups (NSG), use the AzureBackup service tag to allow outbound access to Azure Backup. 除了 Azure 备份标记外,还需要通过为 Azure AD (AzureActiveDirectory) 和 Azure 存储(存储)创建类似的 NSG 规则,以便在连接后进行身份验证和数据传输。In addition to the Azure Backup tag, you also need to allow connectivity for authentication and data transfer by creating similar NSG rules for Azure AD (AzureActiveDirectory) and Azure Storage(Storage). 以下步骤介绍了为 Azure 备份标记创建规则的过程:The following steps describe the process to create a rule for the Azure Backup tag:

  1. 在“所有服务”中,转到“网络安全组”并选择网络安全组。 In All Services, go to Network security groups and select the network security group.

  2. 在“设置”下选择“出站安全规则”。 Select Outbound security rules under Settings.

  3. 选择“添加” 。Select Add. 根据安全规则设置中所述,输入创建新规则所需的所有详细信息。Enter all the required details for creating a new rule as described in security rule settings. 请确保将选项“目标”设置为“服务标记”,将“目标服务标记”设置为“AzureBackup”。Ensure the option Destination is set to Service Tag and Destination service tag is set to AzureBackup.

  4. 选择“添加”,保存新创建的出站安全规则。Select Add to save the newly created outbound security rule.

同样,可以为 Azure 存储和 Azure AD 创建 NSG 出站安全规则。You can similarly create NSG outbound security rules for Azure Storage and Azure AD.

Azure 防火墙标记Azure Firewall tags

如果使用 Azure 防火墙,请使用 AzureBackup Azure 防火墙 FQDN 标记创建应用程序规则。If you're using Azure Firewall, create an application rule by using the AzureBackup Azure Firewall FQDN tag. 这允许对 Azure 备份进行所有出站访问。This allows all outbound access to Azure Backup.

允许访问服务 IP 范围Allow access to service IP ranges

如果选择允许访问服务 IP,请参阅此处的 JSON 文件中的 IP 范围。If you choose to allow access service IPs, refer to the IP ranges in the JSON file available here. 你需要允许访问与 Azure 备份、Azure 存储和 Azure Active Directory 对应的 IP。You'll need to allow access to IPs corresponding to Azure Backup, Azure Storage, and Azure Active Directory.

允许访问服务 FQDNAllow access to service FQDNs

还可以使用以下 FQDN 以允许从服务器访问所需的服务:You can also use the following FQDNs to allow access to the required services from your servers:

服务Service 要访问的域名Domain names to be accessed
Azure 备份Azure Backup *.backup.azure.cn
Azure 存储Azure Storage *.blob.core.chinacloudapi.cn

*.queue.core.chinacloudapi.cn
Azure ADAzure AD 根据这篇文章,允许访问第 56 和 59 节下的 FQDNAllow access to FQDNs under sections 56 and 59 according to this article

使用 HTTP 代理服务器路由流量Use an HTTP proxy server to route traffic

在 Azure VM 中备份 SQL Server 数据库时,该 VM 上的备份扩展将使用 HTTPS API 将管理命令发送到 Azure 备份,并将数据发送到 Azure 存储。When you back up a SQL Server database on an Azure VM, the backup extension on the VM uses the HTTPS APIs to send management commands to Azure Backup and data to Azure Storage. 备份扩展还使用 Azure AD 进行身份验证。The backup extension also uses Azure AD for authentication. 通过 HTTP 代理路由这三个服务的备份扩展流量。Route the backup extension traffic for these three services through the HTTP proxy. 使用上面提到的 IP 和 FQDN 列表,以允许访问所需的服务。Use the list of IPs and FQDNs mentioned above for allowing access to the required services. 不支持已经过身份验证的代理服务器。Authenticated proxy servers aren't supported.

适用于 Azure 备份的数据库命名准则Database naming guidelines for Azure Backup

避免在数据库名称中使用以下元素:Avoid using the following elements in database names:

  • 尾部和前导空格Trailing and leading spaces
  • 尾部感叹号 (!)Trailing exclamation marks (!)
  • 右方括号 (])Closing square brackets (])
  • 分号“;”Semicolon ';'
  • 正斜杠“/”Forward slash '/'

可对不支持的字符使用别名,但我们建议避免这样做。Aliasing is available for unsupported characters, but we recommend avoiding them. 有关详细信息,请参阅 Understanding the Table Service Data Model(了解表服务数据模型)。For more information, see Understanding the Table Service Data Model.

备注

不支持对名称中包含“+”或“&”等特殊字符的数据库执行“配置保护”操作。The Configure Protection operation for databases with special characters like "+" or "&" in their name isn't supported. 可以更改数据库名称或启用“自动保护”,这样可以成功保护这些数据库。You can either change the database name or enable Auto Protection, which can successfully protect these databases.

创建恢复服务保管库Create a Recovery Services vault

恢复服务保管库是用于存储在不同时间创建的备份和恢复点的实体。A Recovery Services vault is an entity that stores the backups and recovery points created over time. 恢复服务保管库还包含与受保护虚拟机关联的备份策略。The Recovery Services vault also contains the backup policies that are associated with the protected virtual machines.

若要创建恢复服务保管库,请执行以下操作:To create a Recovery Services vault:

  1. Azure 门户中登录到自己的订阅。Sign in to your subscription in the Azure portal.

  2. 在左侧菜单中,选择“所有服务”。On the left menu, select All services.

    选择“所有服务”

  3. 在“所有服务”对话框中,输入“恢复服务”。In the All services dialog box, enter Recovery Services. 资源列表根据输入进行筛选。The list of resources filters according to your input. 在资源列表中,选择“恢复服务保管库”。In the list of resources, select Recovery Services vaults.

    输入并选择“恢复服务保管库”

    此时会显示订阅中的恢复服务保管库列表。The list of Recovery Services vaults in the subscription appears.

  4. 在“恢复服务保管库”仪表板上,选择“添加”。On the Recovery Services vaults dashboard, select Add.

    添加恢复服务保管库

    此时会打开“恢复服务保管库”对话框。The Recovery Services vault dialog box opens. 提供“名称”、“订阅”、“资源组”和“位置”的值。Provide values for the Name, Subscription, Resource group, and Location.

    配置恢复服务保管库

    • 名称:输入一个友好名称以标识此保管库。Name: Enter a friendly name to identify the vault. 名称对于 Azure 订阅必须是唯一的。The name must be unique to the Azure subscription. 指定的名称应至少包含 2 个字符,最多不超过 50 个字符。Specify a name that has at least two, but not more than 50 characters. 名称必须以字母开头且只能包含字母、数字和连字符。The name must start with a letter and consist only of letters, numbers, and hyphens.

    • 订阅:选择要使用的订阅。Subscription: Choose the subscription to use. 如果你仅是一个订阅的成员,则会看到该名称。If you're a member of only one subscription, you'll see that name. 如果不确定要使用哪个订阅,请使用默认的(建议的)订阅。If you're not sure which subscription to use, use the default (suggested) subscription. 仅当工作或学校帐户与多个 Azure 订阅关联时,才会显示多个选项。There are multiple choices only if your work or school account is associated with more than one Azure subscription.

    • 资源组:使用现有资源组或创建新组。Resource group: Use an existing resource group or create a new one. 要查看订阅中可用的资源组列表,请选择“使用现有资源”,然后从下拉列表框中选择一个资源。To see the list of available resource groups in your subscription, select Use existing, and then select a resource from the drop-down list box. 若要创建新资源组,请选择“新建”,然后输入名称。To create a new resource group, select Create new and enter the name. 有关资源组的完整信息,请参阅 Azure 资源管理器概述For complete information about resource groups, see Azure Resource Manager overview.

    • 位置:选择保管库的地理区域。Location: Select the geographic region for the vault. 要创建保管库以保护虚拟机,保管库必须与虚拟机位于同一区域中。To create a vault to protect virtual machines, the vault must be in the same region as the virtual machines.

      重要

      如果不确定 VM 的位置,请关闭对话框。If you're not sure of the location of your VM, close the dialog box. 转到门户中的虚拟机列表。Go to the list of virtual machines in the portal. 如果虚拟机位于多个区域,请在每个区域中创建一个恢复服务保管库。If you have virtual machines in several regions, create a Recovery Services vault in each region. 先在第一个位置创建保管库,然后再为其他位置创建保管库。Create the vault in the first location, before you create the vault for another location. 无需指定存储帐户即可存储备份数据。There's no need to specify storage accounts to store the backup data. 恢复服务保管库和 Azure 备份服务会自动处理这种情况。The Recovery Services vault and the Azure Backup service handle that automatically.

  5. 准备好创建恢复服务保管库后,选择“创建”。When you're ready to create the Recovery Services vault, select Create.

    创建恢复服务保管库

    创建恢复服务保管库可能需要一段时间。It can take a while to create the Recovery Services vault. 可在门户右上角“通知”区域监视状态通知。Monitor the status notifications in the Notifications area at the upper-right corner of the portal. 创建保管库后,它会显示在“恢复服务保管库”的列表中。After your vault is created, it's visible in the list of Recovery Services vaults. 如果未看到创建的保管库,请选择“刷新”。If you don't see your vault, select Refresh.

    刷新备份保管库列表

发现 SQL Server 数据库Discover SQL Server databases

如何发现 VM 上运行的数据库:How to discover databases running on a VM:

  1. Azure 门户中,打开用于备份数据库的恢复服务保管库。In the Azure portal, open the Recovery Services vault you use to back up the database.

  2. 在“恢复服务保管库”仪表板中选择“备份”。 In the Recovery Services vault dashboard, select Backup.

    选择“+备份”打开“备份目标”菜单

  3. 在“备份目标”中,将“工作负荷的运行位置”设置为“Azure”。 In Backup Goal, set Where is your workload running? to Azure.

  4. 在“要备份哪些内容”中,选择“Azure VM 中的 SQL Server”。 In What do you want to backup, select SQL Server in Azure VM.

    选择“Azure VM 中的 SQL Server”进行备份

  5. 在“备份目标” > “发现 VM 中的数据库”中,选择“开始发现”以搜索订阅中不受保护的 VM。 In Backup Goal > Discover DBs in VMs, select Start Discovery to search for unprotected VMs in the subscription. 此搜索过程需要花费一段时间,具体取决于订阅中不受保护的 VM 数量。This search can take a while, depending on the number of unprotected VMs in the subscription.

    • 发现后,未受保护的 VM 应会按名称和资源组列在列表中。Unprotected VMs should appear in the list after discovery, listed by name and resource group.

    • 如果某个 VM 未按预期列出,请查看它是否已保管库中备份。If a VM isn't listed as you expect, see whether it's already backed up in a vault.

    • 可能有多个 VM 同名,但它们属于不同的资源组。Multiple VMs can have the same name, but they'll belong to different resource groups.

      在搜索 VM 中的数据库期间,备份将会挂起。

  6. 在 VM 列表中,选择运行 SQL Server 数据库的VM,然后选择“发现数据库”。In the VM list, select the VM running the SQL Server database > Discover DBs.

  7. 在“通知”跟踪数据库发现。Track database discovery in Notifications. 完成此操作所需的时间取决于 VM 数据库的数量。The time required for this action depends on the number of VM databases. 发现选定的数据库后,会显示一条成功消息。When the selected databases are discovered, a success message appears.

    部署成功消息

  8. Azure 备份将发现该 VM 上的所有 SQL Server 数据库。Azure Backup discovers all SQL Server databases on the VM. 在发现期间,后台将发生以下情况:During discovery, the following elements occur in the background:

    • Azure 备份将 VM 注册到用于备份工作负荷的保管库。Azure Backup registers the VM with the vault for workload backup. 已注册 VM 上的所有数据库只能备份到此保管库。All databases on the registered VM can be backed up to this vault only.

    • Azure 备份在 VM 上安装 AzureBackupWindowsWorkload 扩展。Azure Backup installs the AzureBackupWindowsWorkload extension on the VM. 不会在 SQL 数据库中安装任何代理。No agent is installed on a SQL database.

    • Azure 备份在 VM 上创建服务帐户 NT Service\AzureWLBackupPluginSvc。Azure Backup creates the service account NT Service\AzureWLBackupPluginSvc on the VM.

      • 所有备份和还原操作使用该服务帐户。All backup and restore operations use the service account.
      • NT Service\AzureWLBackupPluginSvc 需要 SQL sysadmin 权限。NT Service\AzureWLBackupPluginSvc requires SQL sysadmin permissions. 在市场中创建的所有 SQL Server VM 已预装 SqlIaaSExtension。All SQL Server VMs created in the Marketplace come with the SqlIaaSExtension installed. AzureBackupWindowsWorkload 扩展使用 SQLIaaSExtension 自动获取所需的权限。The AzureBackupWindowsWorkload extension uses the SQLIaaSExtension to automatically get the required permissions.
    • 如果 VM 不是从市场创建的,或者使用的是 SQL 2008 和 2008 R2,则该 VM 上可能未安装 SqlIaaSExtension,并且发现操作将会失败并出现错误消息 UserErrorSQLNoSysAdminMembership。If you didn't create the VM from the Marketplace or if you are on SQL 2008 and 2008 R2, the VM may not have the SqlIaaSExtension installed, and the discovery operation fails with the error message UserErrorSQLNoSysAdminMembership. 若要解决此问题,请按照设置 VM 权限中的说明操作。To fix this issue, follow the instructions under Set VM permissions.

      选择 VM 和数据库

配置备份Configure backup

  1. 在“备份目标” > “步骤 2: 配置备份”中,选择“配置备份”。In Backup Goal > Step 2: Configure Backup, select Configure Backup.

    选择“配置备份”

  2. 选择“添加资源”,查看所有已注册的可用性组和独立的 SQL Server 实例。Select Add Resources to see all the registered availability groups and standalone SQL Server instances.

    选择“添加资源”

  3. 在“选择要备份的项中”,选择行左侧的箭头,展开该实例或 Always On 可用性组中所有不受保护的数据库的列表。In the Select items to backup screen, select the arrow to the left of a row to expand the list of all the unprotected databases in that instance or Always On availability group.

    选择要备份的项

  4. 选择要保护的所有数据库,然后选择“确定”。Choose all the databases you want to protect, and then select OK.

    保护数据库

    为了优化备份负载,Azure 备份会将一个备份作业中的最大数据库数目设置为 50。To optimize backup loads, Azure Backup sets a maximum number of databases in one backup job to 50.

    • 若要对 50 个以上的数据库提供保护,请配置多个备份。To protect more than 50 databases, configure multiple backups.

    • 若要启用整个实例或 Always On 可用性组,请在“自动保护”下拉列表中选择“打开”,然后选择“确定”。 To enable the entire instance or the Always On availability group, in the AUTOPROTECT drop-down list, select ON, and then select OK.

      备注

      自动保护功能不仅可以一次性针对所有现有数据库启用保护,而且还会自动保护添加到该实例或可用性组的所有新数据库。The auto-protection feature not only enables protection on all the existing databases at once, but also automatically protects any new databases added to that instance or the availability group.

  5. 定义备份策略。Define the Backup policy. 可以执行以下操作之一:You can do one of the following:

    • 选择 HourlyLogBackup 作为默认策略。Select the default policy as HourlyLogBackup.

    • 选择前面为 SQL 创建的现有备份策略。Choose an existing backup policy previously created for SQL.

    • 根据 RPO 和保留范围定义新策略。Define a new policy based on your RPO and retention range.

      选择“备份策略”

  6. 选择“启用备份”以提交“配置保护”操作,并在门户的“通知”区域中跟踪配置进度 。Select Enable Backup to submit the Configure Protection operation and track the configuration progress in the Notifications area of the portal.

    跟踪配置进度

创建备份策略Create a backup policy

备份策略定义备份创建时间以及这些备份的保留时间。A backup policy defines when backups are taken and how long they're retained.

  • 策略是在保管库级别创建的。A policy is created at the vault level.
  • 多个保管库可以使用相同的备份策略,但必须向每个保管库应用该备份策略。Multiple vaults can use the same backup policy, but you must apply the backup policy to each vault.
  • 创建备份策略时,每日完整备份是默认设置。When you create a backup policy, a daily full backup is the default.
  • 可以添加差异备份,但仅在将完整备份配置为每周发生时,才能这样做。You can add a differential backup, but only if you configure full backups to occur weekly.
  • 了解不同类型的备份策略Learn about different types of backup policies.

创建备份策略:To create a backup policy:

  1. 在保管库中,选择“备份策略” > “添加”。 In the vault, select Backup policies > Add.

  2. 在“添加”中,选择“Azure VM 中的 SQL Server”以定义策略类型。 In Add, select SQL Server in Azure VM to define the policy type.

    为新的备份策略选择策略类型

  3. 在“策略名称”处输入新策略的名称。In Policy name, enter a name for the new policy.

    输入策略名称

  4. 选择“完整备份”对应的“编辑”链接以修改默认设置 。Select the Edit link corresponding, to Full backup, to modify the default settings.

    • 选择“备份频率”。Select a Backup Frequency. 选择“每日”或“每周”。 Choose either Daily or Weekly.

    • 如果选择“每日”,请选择备份作业开始时的小时和时区。For Daily, select the hour and time zone when the backup job begins. 对于每日完整备份,无法创建差异备份。You can't create differential backups for daily full backups.

      新备份策略字段

  5. 对于“保留范围”,默认已选择所有选项。In RETENTION RANGE, all options are selected by default. 清除任何不需要的保留范围限制,然后设置要使用的间隔。Clear any retention range limits that you don't want, and then set the intervals to use.

    • 任何类型的备份(完整、差异和日志)的最短保留期均为七天。Minimum retention period for any type of backup (full, differential, and log) is seven days.

    • 恢复点已根据其保留范围标记为保留。Recovery points are tagged for retention based on their retention range. 例如,如果选择每日完整备份,则每天只触发一次完整备份。For example, if you select a daily full backup, only one full backup is triggered each day.

    • 根据每周保留范围和每周保留设置,将会标记并保留特定日期的备份。The backup for a specific day is tagged and retained based on the weekly retention range and the weekly retention setting.

    • 每月和每年保留范围的行为类似。Monthly and yearly retention ranges behave in a similar way.

      保留范围间隔设置

  6. 选择“确定”接受设置来进行完整备份。Select OK to accept the setting for full backups.

  7. 选择“差异备份”对应的“编辑”链接以修改默认设置 。Select the Edit link corresponding to Differential backup, to modify the default settings.

    • 在“差异备份策略”中,选择“启用”打开频率和保留控件。 In Differential Backup policy, select Enable to open the frequency and retention controls.

    • 每天只能触发一次差异备份。You can trigger only one differential backup per day. 不能在执行完整备份的同一天触发差异备份。A differential backup can't be triggered on the same day as a full backup.

    • 差异备份最多可以保留 180 天。Differential backups can be retained for a maximum of 180 days.

    • Master 数据库不支持差异备份。Differential Backup isn't supported for the master database.

      差异备份策略

  8. 选择“日志备份”对应的“编辑”链接以修改默认设置 Select the Edit link corresponding to Log backup, to modify the default settings

    • 在“日志备份”中选择“启用”,并设置频率和保留控件。 In Log Backup, select Enable, and then set the frequency and retention controls.

    • 日志备份最多可以每隔 15 分钟发生一次,最多可以保留 35 天。Log backups can occur as often as every 15 minutes and can be retained for up to 35 days.

    • 如果数据库处于简单恢复模式中,则该数据库的日志备份计划将暂停,因此不会触发日志备份。If the database is in the simple recovery model, the log backup schedule for that database will be paused and so no log backups will be triggered.

    • 如果数据库的恢复模式从“完整”更改为“简单”,则日志备份将在恢复模式更改后的 24 小时内暂停 。If the recovery model of the database changes from Full to Simple, log backups will be paused within 24 hours of the change in the recovery model. 同样,如果恢复模式从“简单”更改为其他模式,则表示数据库现在支持日志备份,日志备份计划将在恢复模式更改后的 24 小时内启用。Similarly, if the recovery model changes from Simple, implying log backups can now be supported for the database, the log backups schedules will be enabled within 24 hours of the change in recovery model.

      日志备份策略

  9. 在“备份策略”菜单中,选择是否启用“SQL 备份压缩” 。On the Backup policy menu, choose whether to enable SQL Backup Compression or not. 默认已禁用此选项。This option is disabled by default. 如果启用,SQL Server 会向 VDI 发送压缩的备份流。If enabled, SQL Server will send a compressed backup stream to the VDI. Azure 备份将根据此控件的值,使用 COMPRESSION / NO_COMPRESSION 子句替代实例级别的默认值。Azure Backup overrides instance level defaults with COMPRESSION / NO_COMPRESSION clause depending on the value of this control.

  10. 完成备份策略的编辑后,选择“确定”。 After you complete the edits to the backup policy, select OK.

备注

每个日志备份都链接到上一个完整备份,以形成恢复链。Each log backup is chained to the previous full backup to form a recovery chain. 此完整备份将一直保留到最后一个日志备份的保留期结束为止。This full backup will be retained until the retention of the last log backup has expired. 这可能意味着完整备份会保留一段额外的时间,以确保所有日志都可以恢复。This might mean that the full backup is retained for an extra period to make sure all the logs can be recovered. 假设你有每周完整备份、每日差异备份和 2 小时日志备份。Let's assume you have a weekly full backup, daily differential and 2 hour logs. 所有这些备份都将保留 30 天。All of them are retained for 30 days. 但是,只有在下一个完整备份可用后(即 30 + 7 天后),才能真正清除/删除这个每周完整备份。But, the weekly full can be really cleaned up/deleted only after the next full backup is available, that is, after 30 + 7 days. 例如,每周完整备份在 11 月 16 日执行。For example, a weekly full backup happens on Nov 16th. 根据保留策略,它应保留到 12 月 16 日。According to the retention policy, it should be retained until Dec 16th. 该完整备份的最后一次日志备份发生在下一次计划的完整备份之前,即 11 月 22 日。The last log backup for this full happens before the next scheduled full, on Nov 22nd. 必须等到 12 月 22 日此日志备份可用后,才能删除 11 月 16 日的完整备份。Until this log is available until Dec 22nd, the Nov 16th full can't be deleted. 因此,11 月 16 日的完整备份会保留到 12 月 22 日。So, the Nov 16th full is retained until Dec 22nd.

启用自动保护Enable auto-protection

可以启用自动保护,以便自动将所有现有数据库和将来的数据库备份到独立 SQL Server 实例或 Always On 可用性组。You can enable auto-protection to automatically back up all existing and future databases to a standalone SQL Server instance or to an Always On availability group.

  • 可以一次性选择进行自动保护的数据库数目没有限制。There's no limit on the number of databases you can select for auto-protection at a time. 发现通常每 8 小时运行一次。Discovery typically runs every eight hours. 但是,如果通过选择“重新发现数据库”选项来手动运行发现,则可以立即发现并保护新的数据库。However, you can discover and protect new databases immediately if you manually run a discovery by selecting the Rediscover DBs option.
  • 启用自动保护时,无法选择在实例中保护数据库,或者在实例中排除对其的保护。You can't selectively protect or exclude databases from protection in an instance at the time you enable auto-protection.
  • 如果实例已包含某些受保护的数据库,即使在启用自动保护后,它们也仍会根据相应的策略受到保护。If your instance already includes some protected databases, they'll remain protected under their respective policies even after you turn on auto-protection. 以后添加的所有不受保护的数据库只会应用在启用自动保护时定义的、在“配置备份”下列出的单个策略。All unprotected databases added later will have only a single policy that you define at the time of enabling auto-protection, listed under Configure Backup. 但是,以后可以更改与自动保护的数据库关联的策略。However, you can change the policy associated with an auto-protected database later.

若要启用自动保护:To enable auto-protection:

  1. 在“要备份的项”中,选择要为其启用自动保护的实例。In Items to backup, select the instance for which you want to enable auto-protection.

  2. 选择“自动保护”下的下拉列表,选择“打开”,然后选择“确定”。 Select the drop-down list under AUTOPROTECT, choose ON, and then select OK.

    针对可用性组启用自动保护

  3. 备份是针对所有数据库统一配置的,可以在“备份作业”中跟踪备份。Backup is configured for all the databases together and can be tracked in Backup Jobs.

如果需要禁用自动保护,请选择“配置备份”下的实例名称,然后针对该实例选择“禁用自动保护”。 If you need to disable auto-protection, select the instance name under Configure Backup, and then select Disable Autoprotect for the instance. 所有数据库将继续备份,但将来的数据库不会自动受到保护。All databases will continue to be backed up, but future databases won't be automatically protected.

针对该实例禁用自动保护

后续步骤Next steps

了解如何:Learn how to: