Unlock the Power of AI

1 million free tokens

88% Price Reduction

Activate Now

Migrate data from a self-managed SQL Server database to an ApsaraDB RDS for SQL Server instance by using a physical protocol gateway

Updated at: 2025-02-13 07:38
important

This topic contains important information on necessary precautions. We recommend that you read this topic carefully before proceeding.

This topic describes how to migrate data from a self-managed SQL Server database hosted on an Elastic Compute Service (ECS) instance, in a data center, or on a cloud server of another cloud service provider to an ApsaraDB RDS for SQL Server instance by using a physical protocol gateway in the Data Transmission Service (DTS) console. A physical protocol gateway is easy to use, ensures fast and stable migration, is suitable for all scenarios, and can effectively improve migration efficiency.

Prerequisites

  • The self-managed SQL Server database meets the following requirements:

    • The self-managed SQL Server database runs SQL Server 2019, SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, or SQL Server 2005.

      Note

      The self-managed SQL Server database resides on an ECS instance, in a data center, or on a third-party cloud server. The self-managed SQL Server database cannot be an RDS instance.

    • The physical protocol gateway of Data Disaster Recovery is installed on the server on which the self-managed SQL Server database resides. For more information, see Appendix: Create a physical protocol gateway.

      Note

      You must install the physical protocol gateway in the same region as the RDS instance.

  • The RDS instance meets the following requirements:

    • The RDS instance runs SQL Server 2019, SQL Server 2017, SQL Server 2016, SQL Server 2012, or SQL Server 2008 R2.

    • The RDS instance runs the same major engine version as the self-managed SQL Server database or a later major engine version.

  • The following permissions are granted by using your Alibaba Cloud account:

    • An AccessKey pair is created, and the AccessKey ID and AccessKey secret are obtained. The AccessKey pair is used for identity authentication when you register with or log on to the DBS console from your backup gateway. For more information, see Obtain an AccessKey pair.

    • The AliyunDBSFullAccess permissions is obtained if you want to add a backup gateway by using a Resource Access Management (RAM) user. For more information, see Grant permissions to a RAM user.

      Note
      • By default, the preceding permissions are granted to your Alibaba Cloud account when you activate Data Disaster Recovery.

      • After you add a backup gateway, the backup gateway is available in the Data Disaster Recovery console to all RAM users that belong to your Alibaba Cloud account.

Comparison between physical gateway-based migration and logical data migration

Item

Physical protocol gateway-based migration

Logical data migration

Item

Physical protocol gateway-based migration

Logical data migration

Migration principle

The native physical backup protocol is used to write data to the destination database as data blocks.

The JDBC protocol is used to obtain SQL statements and write the statements to the destination database.

Operating system

Only SQL Server on Windows is supported. The version of the desktop operating system cannot be earlier than Windows XP. The version of the server operating system cannot be earlier than Windows Server 2003.

Unlimited.

Deployment

A physical protocol gateway must be installed on the server on which the database resides.

You do not need to install a gateway.

Network connectivity

The server on which the self-managed database is deployed can connect to the network of Alibaba Cloud.

Note

If the server on which your self-managed database is deployed cannot access the Internet but uses a bastion host for network communication, you can migrate data from the self-managed SQL Server database to an RDS instance by following instructions provided in Migrate data from a self-managed SQL Server database to an ApsaraDB RDS for SQL Server instance by using the physical gateway on a bastion host.

The port to connect to the database must be enabled, or leased line-based connections must be established.

Source database permissions

The sysadmin role is required.

The SELECT permission is required for schema migration and full migration. The sysadmin permission is required for incremental migration. For more information, see Permissions required for database accounts.

Destination database version

The engine version of the destination database must be the same or later than the engine version of the source database.

You can migrate data from a source database that runs an engine version later than or earlier than the engine version of the destination database.

Destination database accessibility

The destination database is inaccessible during data migration.

You can read data from or write data to the destination database during data migration.

Limits on tables that can be migrated from the source database

Memory tables cannot be migrated. Fields of the FileStream and FileTables types cannot be migrated.

For more information, see Migrate data from a self-managed SQL Server database to an ApsaraDB RDS for SQL Server instance.

Migration scenarios

Data can be migrated from self-managed databases to the cloud.

Note

The self-managed SQL Server databases can reside on ECS instances, in data centers, or on third-party cloud servers.

Data can be migrated from self-managed databases or cloud-hosted databases to the cloud.

Migration efficiency

High.

Medium.

Data processing extract, transform, load (ETL)

Not supported.

Supported.

Table-level data filtering

Not supported.

Supported.

Database-level data filtering

Supported.

Supported.

Limits

Category

Description

Category

Description

Limits on the source database

  • Only SQL Server on Windows is supported. The version of the desktop operating system cannot be earlier than Windows XP. The version of the server operating system cannot be earlier than Windows Server 2003.

  • The size of the source database cannot exceed the remaining storage of the destination RDS instance. Otherwise, the cloud migration fails.

  • The server on which the source database is deployed can access the Internet.

  • The name of the source database cannot be the same as the name of the destination database on the RDS instance.

  • The name of the source database cannot be the same as the names of some system databases or other database names that cannot be used. Examples:

    reserved_dbname = ["master", "tempdb", "msdb", "model", "distribution","rdscore","sys_info"]
  • The network settings of the source database must meet the following requirements:

    • If the firewall for the source database is disabled and the source database is a self-managed database on an ECS instance, you can connect the source database and the destination database over a virtual private cloud (VPC) or the Internet.

    • If the firewall for the source database is disabled and the source database is a self-managed database that does not reside on an ECS instance, you can connect the source database and the destination database over the Internet.

    • If the firewall for the source database is enabled, you must allow requests from *.aliyuncs.com to ensure that the source database can communicate with the destination database.

Database version and edition

The destination SQL Server version must be later than or the same as the source SQL Server version. The versions and editions of SQL Server are in the following sequential orders:

  • 2019 > 2017 > 2016 > 2012 > 2008 R2 > 2005

  • SQL Server Developer > SQL Server Standard > SQL Server Web > SQL Server Express

Note

For more information about the migration mappings that are supported by each edition, see the Migration types that are supported by each SQL Server version section in this topic.

In-Memory OLTP feature and Mirroring technology

The In-Memory Online Transaction Processing System (OLTP) feature of SQL Server is incompatible with the Mirroring technology. If the In-Memory OLTP feature is enabled for your source database, the destination database cannot be an ApsaraDB RDS instance of High-availability Edition.

Number of databases

The maximum number of databases that you can create in an ApsaraDB RDS instance varies based on the instance type. If you need to migrate multiple databases to an ApsaraDB RDS instance, make sure that the number of databases in the destination instance after the migration does not exceed the limit. For more information, see Maximum number of databases.

Other limits

  • When a physical migration task is in progress, you cannot back up databases. If you want to back up databases during physical migration, you must enable COPY_ONLY.

  • Fields of the FileStream and FileTables types cannot be migrated.

  • You can migrate a single database, multiple databases, or the entire instance.

  • Memory tables cannot be migrated.

Usage notes

  • During data migration, data can be incrementally written to the self-managed SQL Server database. We recommend that you do not write data to the self-managed SQL Server database during the workload switchover to prevent data inconsistency.

  • During incremental migration, the RDS instance becomes temporarily unavailable. Wait until the incremental migration task is complete and use the RDS instance after the workloads are switched over to the RDS instance.

Migration types that are supported by each SQL Server version

Engine version of the source database

Engine version of the RDS instance

Engine version of the source database

Engine version of the RDS instance

SQL Server Developer, SQL Server Standard, SQL Server Web, and SQL Server Express

SQL Server Enterprise

SQL Server Standard, SQL Server Web, and SQL Server Express

SQL Server Standard

SQL Server Web and SQL Server Express

SQL Server Web

Procedure

  1. Use one of the following methods to go to the Data Migration page and select the region in which the data migration instance resides.

    DTS console
    DMS console
    1. Log on to the DTS console.

    2. In the left-side navigation pane, click Data Migration.

    3. In the upper-left corner of the page, select the region in which the data migration instance resides.

    Note

    The actual operation may vary based on the mode and layout of the DMS console. For more information, see Simple mode and Customize the layout and style of the DMS console.

    1. Log on to the DMS console.

    2. In the top navigation bar, move the pointer over Data Development > DTS (DTS) > Data Migration .

    3. From the drop-down list to the right of Data Migration Tasks, select the region in which the data synchronization instance resides.

  2. Click Create Task to go to the task configuration page.

  3. Configure the source and destination databases. The following table describes the parameters.

    Warning

    After you configure the source and destination databases, we recommend that you read the Limits that are displayed in the upper part of the page. Otherwise, the task may fail or data inconsistency may occur.

    Section

    Parameter

    Description

    Section

    Parameter

    Description

    N/A

    Task Name

    The name of the DTS task. DTS automatically generates a task name. We recommend that you specify an informative name that makes it easy to identify the task. You do not need to specify a unique task name.

    Source Database

    Select a DMS database instance

    The database that you want to use. You can choose whether to use an existing database based on your business requirements.

    • If you select an existing database, DTS automatically populates the parameters for the database.

    • If you do not select an existing database, you must configure the following database information.

    Database Type

    The type of the source database. Select SQL Server.

    Access Method

    The access method of the source database. Select Physical Protocol.

    Instance Region

    The region in which the self-managed SQL Server database resides.

    Physical Protocol Gateway (DBS Backup Gateway)

    The physical protocol gateway that is used for this task.

    Note

    For more information about how to install a physical protocol gateway, see the Appendix: Create a physical protocol gateway section in this topic.

    Hostname or IP address

    The hostname or IP address of the self-managed SQL Server database. Default value: localhost.

    Port Number

    The service port number of the self-managed SQL Server database. Default value: 1433.

    Destination Database

    Select a DMS database instance

    The instance that you want to use. You can choose whether to use an existing instance based on your business requirements.

    • If you select an existing instance, DTS automatically applies the parameter settings of the instance. You do not need to configure the corresponding parameters again.

    • If you do not use an existing instance, you must configure parameters for the database.

    Database Type

    The type of the destination database. Default value: SQL Server.

    Access Method

    The access method of the destination database. Default value: Alibaba Cloud Instance.

    Instance Region

    The region in which the destination ApsaraDB RDS for SQL Server instance resides.

    Instance ID

    The ID of the destination ApsaraDB RDS for SQL Server instance.

    Database Account

    The database account that is used to access the destination ApsaraDB RDS for SQL Server instance.

    Note

    For more information about how to create a database account and grant permissions to the account, see Create a privileged account or a standard account and Modify the permissions of an account.

    Database Password

    The password that is used to access the destination ApsaraDB RDS for SQL Server instance.

  4. Click Test Connectivity and Proceed.

  5. In the CIDR Blocks of DTS Servers dialog box, click Test Connectivity and Proceed.

    If the source or destination database is an Alibaba Cloud database instance, such as an ApsaraDB RDS for MySQL or ApsaraDB for MongoDB instance, DTS automatically adds the CIDR blocks of DTS servers to the IP address whitelist of the instance. If the source or destination database is a self-managed database hosted on an Elastic Compute Service (ECS) instance, DTS automatically adds the CIDR blocks of DTS servers to the security group rules of the ECS instance, and you must make sure that the ECS instance can access the database. If the self-managed database is hosted on multiple ECS instances, you must manually add the CIDR blocks of DTS servers to the security group rules of each ECS instance. If the source or destination database is a self-managed database that is deployed in a data center or provided by a third-party cloud service provider, you must manually add the CIDR blocks of DTS servers to the IP address whitelist of the database to allow DTS to access the database. For more information, see the CIDR blocks of DTS servers section of the Add the CIDR blocks of DTS servers topic.

    Warning

    If the public CIDR blocks of DTS servers are automatically or manually added to the whitelist of a database instance or to the security group rules of an ECS instance, security risks may arise. Therefore, before you use DTS to migrate data, you must understand and acknowledge the potential risks and take preventive measures, including but not limited to the following measures: enhancing the security of your username and password, limiting the ports that are exposed, authenticating API calls, regularly checking the whitelist or security group rules and forbidding unauthorized CIDR blocks, or connecting the database instance to DTS by using Express Connect, VPN Gateway, or Smart Access Gateway.

  6. Select the objects to be migrated and configure advanced settings.

    Parameter

    Description

    Parameter

    Description

    Task Stages

    • To perform only full data migration, select Full Data Migration, which is required by default.

    • To ensure service continuity during data migration, select Full Data Migration and Incremental Data Migration.

    Note

    If Incremental Data Migration is not selected, we recommend that you do not write data to the source instance during data migration. This ensures data consistency between the source and destination databases.

    Source Objects

    The objects in the source database. Select one or more objects from the Source Objects section and click the Rightwards arrow icon to add the objects to the Selected Objects section.

    Note

    You can migrate a database, multiple databases, or the entire instance.

    Selected Objects

    The objects to be migrated.

  7. Click Next: Advanced Settings to go to the Advanced Settings page.

    Parameter

    Description

    Parameter

    Description

    Monitoring and Alerting

    Specifies whether to configure alerting for the data migration task. If the task fails or the migration latency exceeds the specified threshold, the alert contacts receive notifications. Valid values:

    1. No: does not configure alerting.

    2. Yes: configures alerting. In this case, you must also configure the alert threshold and alert notification settings. For more information, see the Configure monitoring and alerting when you create a DTS task section of the Configure monitoring and alerting topic.

    Retry Time for Failed Connection

    The retry time range for failed connections. If the source or destination database fails to be connected after the data migration task is started, DTS immediately retries a connection within the time range. Valid values: 10 to 1440. Unit: minutes. Default value: 720. We recommend that you set the parameter to a value greater than 30. If DTS reconnects to the source and destination databases within the specified time range, DTS resumes the data migration task. Otherwise, the data migration task fails.
    Note
    • If you set different retry time ranges for multiple data migration tasks that have the same source or destination database, the shortest retry time range that is set takes precedence.
    • When DTS retries a connection, you are charged for the DTS instance. We recommend that you specify the retry time range based on your business requirements. You can also release the DTS instance at your earliest opportunity after the source and destination instances are released.
  8. In the lower-right corner of the page, click Next: Save Task Settings and Precheck.

    Note
    • DTS performs a precheck before a data migration task starts. You can start a data migration task only after the task passes the precheck.

    • If the task fails to pass the precheck, click the Info icon next to each failed item to view details.

      • After you troubleshoot the issues based on the causes, you can run a precheck again.

      • If you do not need to troubleshoot the issues, ignore the failed items and initiate a new precheck.

  9. On the Precheck step, after Success Rate reaches 100%, click Next: Purchase Instance.

  10. On the buy page, read and agree to the terms of service by selecting the check box.

  11. Click Buy and Start and then Confirm to start the data migration task.

    You can click the ID of the data migration task on the Data Migration Tasks page and view the migration progress on the Task Management page.

    Note

    You can also view the progress of full or incremental migration in the ApsaraDB RDS console. Log on to the ApsaraDB RDS console. On the Instances page, find the instance that you want to view and click the name of the instance. On the page that appears, click Backup and Restoration to view the progress.

  12. When the progress of the full migration task is 100% and the incremental migration task is in the Running state, choose Task Management > Incremental Data Migration, and then click the button for switching workloads to the cloud.

  13. In the Are you sure that you want to switch to the cloud? message, click Start Now and wait until the switchover is complete.

    Note

    To ensure that data is consistent, we recommend that you stop writing data to the source instance first, wait until the switchover is complete, and then switch your business to the ApsaraDB RDS instance. The switchover process takes several minutes.

Appendix: Create a physical protocol gateway

This section describes how to create a physical protocol gateway.

Prerequisites

You must assign the sysadmin role to the NT AUTHORITY\SYSTEM account. You can execute an SQL statement to assign the role.

ALTER SERVER ROLE [sysadmin] ADD MEMBER [NT AUTHORITY\SYSTEM]
GO

Usage notes

AliyunDBSAgent sets the recovery model of the database that you want to migrate to Full.

Note

If the recovery mode is Full and data is continuously written to the database, the disk space of the source database is occupied. This may exhaust the disk space of the source database. To prevent this issue, we recommend that you execute the following statement to set the recovery model to Simple after a data migration task is complete:

ALTER DATABASE Database name SET RECOVERY Simple;

Procedure

  1. On the Configure Source and Destination Databases page, click Create Physical Protocol Gateway.

  2. In the Installation Command dialog box, configure the Region of Backup Gateway and Network Type of Backup Gateway parameters. Then, copy the command to install the physical protocol gateway and download the installation package.

    Note
    • Public Network: You can access Data Disaster Recovery by using a public IP address.

    • ECS Private Network/VPC: You can access Data Disaster Recovery by using a leased line from Alibaba Cloud.

  3. Install AliyunDBSAgent on a Windows device or server.

    1. Double-click the setup.exe file in the downloaded file.

    2. Select the installation language, click OK, and then click Next.

    3. Read and accept the terms of the agreement and click Next.

    4. Select Physical Protocol Gateway (DBS Backup Gateway) and click Next.

    5. Select an installation directory, click Next, and then click Yes.

    6. Confirm the region that is specified by the Agent Region parameter, enter the AccessKey ID and AccessKey secret, and then click Next.

      Important
      • Make sure that the region in which the physical protocol gateway is installed is the same as the region of the RDS instance.

      • The AccessKey pair information is stored in the plaintext format in the .\config\dbs-agent.conf file of the installation directory.

    7. Confirm the component package that you want to install and click Next.

      The installation starts. The process requires approximately 1 to 5 minutes.

    8. Click Done.

      You can view the installation progress of the gateway in the C:\Program Files\aliyun\dbs_agent\logs\agent.log installation directory. If information similar to the following figure is displayed, the gateway is installed. 网关的进程心跳

  4. In the Installation Command dialog box of the DTS console, click Installed.

  5. Check whether the physical protocol gateway is started.

    1. In the Run dialog box of Windows, enter services.msc and click OK.

      The service manager dialog box of the system appears.

    2. In the service manager dialog box, check whether the AliyunDBSAgent service is started. If the service is not started, right-click AliyunDBSAgent and select Start.

      Note

      By default, the system starts the backup gateway. You can also start and stop the AliyunDBSAgent service in the service manager.

  6. View the created physical protocol gateway.

    On the Backup Gateways page of the DBS console, click Refresh to view the created physical protocol gateway.

    Note

    The name of the new physical protocol gateway starts with DTS_.

  • On this page (1, O)
  • Prerequisites
  • Comparison between physical gateway-based migration and logical data migration
  • Limits
  • Usage notes
  • Migration types that are supported by each SQL Server version
  • Procedure
  • Appendix: Create a physical protocol gateway
Feedback
phone Contact Us

Chat now with Alibaba Cloud Customer Service to assist you in finding the right products and services to meet your needs.

alicare alicarealicarealicare