You can use Hybrid Backup Recovery (HBR) to back up SQL Server databases deployed on Alibaba Cloud Elastic Compute Service (ECS) instances and restore these databases as required. This topic describes the preparations that you need to make before backing up data.

Note Currently, HBR can back up and restore SQL Server databases deployed on ECS instances in the following regions: China (Beijing), China (Shanghai), China (Shenzhen), China (Hangzhou), China (QingDao), China (Zhangjiakou), China (Hohhot), China (Hong Kong), Singapore, US (Silicon Valley), Indonesia (Jakarta), Malaysia (Kuala Lumpur), Australia (Sydney), Germany (Frankfurt) and Japan (Tokyo). This feature will be available in other regions soon.

Step 1: Authorize roles

Before you use HBR to back up SQL Server databases deployed on ECS instances, you must authorize the AliyunHBRDefaultRole and AliyunECSAccessingHBRRole roles to access your cloud resources. To authorize the two roles, follow these steps:

  1. Log on to theHBR console.
  2. In the left-side navigation pane, chooseBackup > ECS Application Backup. On the ECS Application Backup page, selectSQL Server. In the authorization dialog boxes that appear one by one, authorize the two roles to access your cloud resources as prompted.

Step 2: Install and configure Cloud Assistant

  • An ECS backup client must work with Cloud Assistant. By default, a Cloud Assistant client is installed on ECS instances that are created after December 1, 2017. For ECS instances purchased before December 1, 2017, you mustinstall a Cloud Assistant client.
  • After a Cloud Assistant client is installed on an ECS instance whose network type is classic network, configure the Cloud Assistant client based on the operating system of the ECS instance.
    • Windows:
      1. Connect to the ECS instance. In theC:\ProgramData\aliyun\assist\path, create a file namedregion-idand enter theregion IDin the file based on the region where the ECS instance resides. For example, for an ECS instance that resides in the China (Hangzhou) region, entercn-hangzhou.

        The following table lists regions and their IDs.

        Region Region ID
        China (Hangzhou) cn-hangzhou
        China (Shanghai) cn-shanghai
        China (Beijing) cn-beijing
        China (Shenzhen) cn-shenzhen
      2. Restart AliyunService in Task Manager.
    • Linux:
      1. Connect to the ECS instance. In the/usr/local/share/aliyun-assist/directory, create a file namedregion-idand enter theregion IDin the file based on the region where the ECS instance resides. For example, for an ECS instance that resides in the China (Hangzhou) region, entercn-hangzhou.
        The following table lists regions and their IDs.
        Region Region ID
        China (Hangzhou) cn-hangzhou
        China (Shanghai) cn-shanghai
        China (Beijing) cn-beijing
        China (Shenzhen) cn-shenzhen
      2. Restart the Cloud Assistant client. You can run thechkconfig agentwatch offcommand and then thechkconfig agentwatch oncommand. Alternatively, you can run thesystemctl restart agentwatchcommand.
        Note If the Cloud Assistant client still does not work after the restart, run the preceding commands to restart it again.

Step 3: Create a database group to be backed up

Before you back up data, you must group databases by backup plan. To create a database group, follow these steps:

Note If you want to back up a database separately, create a group exclusively for this database.
  1. Log on to theHBR console.
  2. In the left-side navigation pane, chooseBackup > ECS Application Backup. On the ECS Application Backup page, selectSQL Server.
  3. On the page that appears, click theDatabase Grouptab. On the Database Group tab, clickCreate Database Groupin the upper-right corner.
  4. In theCreate Database Grouppane that appears, setGroup NameandDescription. Then, select one or more databases and add them to the group.
  5. ClickOK.

(Recommended) Limit the memory usage for an SQL Server instance

By default, SQL Server instances occupy as much system memory as possible. This may affect normal backup. Therefore, we recommend that you follow these steps to limit the memory usage of an SQL Server instance:

  1. Start SQL Server Management Studio and connect to the target SQL Server instance.
  2. Right-click the instance name and selectProperties.
  3. In the dialog box that appears, click Memory in the left-side navigation pane. On theMemorytab, setMaximum server memory.
    Note We recommend that you reserve at least 2 GB memory for backup and other system services. For example, if the system memory is 16 GB, the recommended value of Maximum server memory is14336for the SQL Server instance.