All Products
Search
Document Center

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

Last Updated:Mar 28, 2026

Use the physical gateway-based migration feature of Data Transmission Service (DTS) to migrate a self-managed SQL Server database to ApsaraDB RDS for SQL Server. Physical gateway migration uses the native physical backup protocol to transfer data as blocks, making it faster than logical migration and suitable for large databases.

This topic covers two network scenarios — direct Internet access and bastion host — so you can follow the path that matches your environment.

Choose a migration scenario

ScenarioWhen to useSteps
Scenario 1: Direct Internet accessThe server where the self-managed database runs has direct access to the Internet1. Install the Database Backup Service (DBS) backup gateway on the database server. 2. Create a DTS migration task using Physical Protocol.
Scenario 2: Bastion hostThe database server has no Internet access but connects through a bastion host1. Install a proxy gateway on the bastion host. 2. Install the DBS backup gateway on the database server, pointing to the proxy gateway. 3. Create a DTS migration task using Physical Protocol.

For a comparison between physical gateway migration and logical migration, see Appendix: Physical gateway migration vs. logical migration.

Prerequisites

Scenario 1: Direct Internet access

Before you begin, ensure that you have:

  • A self-managed SQL Server database running SQL Server 2005, 2008 R2, 2012, 2014, 2016, 2017, or 2019. The database can reside on an ECS instance, in a data center, or on a third-party cloud server. Cloud databases are not supported.

  • An ApsaraDB RDS for SQL Server instance running SQL Server 2008 R2, 2012, 2016, 2017, or 2019, with the same or a later engine version than the source database.

  • An AccessKey ID and AccessKey Secret for backup gateway identification and registration. See Create an AccessKey pair.

  • (If using a RAM user) The AliyunDBSFullAccess permission granted to the RAM user. See Grant permissions to a RAM user.

Scenario 2: Bastion host

Before you begin, ensure that you have:

  • A self-managed SQL Server database running SQL Server 2005, 2008 R2, 2012, 2014, 2016, 2017, or 2019. The database can reside on an ECS instance, in a data center, or on a third-party cloud server. Cloud databases are not supported.

  • An ApsaraDB RDS for SQL Server instance running SQL Server 2008 R2, 2012, 2016, 2017, or 2019, with the same or a later engine version than the source database.

  • An AccessKey ID and AccessKey Secret for backup gateway identification and registration. See Create an AccessKey pair.

  • (If using a RAM user) The AliyunDBSFullAccess permission granted to the RAM user. See Grant permissions to a RAM user.

  • (If the bastion host runs Linux) Java Runtime Environment (JRE) 1.8 installed on the database server. Download from the Oracle official website.

  • The HTTP_PROXY and HTTPS_PROXY environment variables not set on the database server. If these variables are set, the system uses the specified proxy instead of the installed gateway, causing connection failures.

Limitations

Review these limitations before you start. Violations cause migration failures.

Source database limitations

  • Only SQL Server on Windows is supported. The desktop OS must be Windows XP or later; the server OS must be Windows Server 2003 or later.

  • The source database size cannot exceed the remaining storage of the destination RDS instance.

  • The source database name cannot match the destination database name on the RDS instance.

  • The following database names are reserved and cannot be used as the source database name:

    master, tempdb, msdb, model, distribution, rdscore, sys_info
  • Network requirements for the source database:

    • If the firewall is disabled and the database runs on an ECS instance, connect over a virtual private cloud (VPC) or the Internet.

    • If the firewall is disabled and the database does not run on an ECS instance, connect over the Internet.

    • If the firewall is enabled, allow requests from *.aliyuncs.com.

Version compatibility

The destination RDS instance must run the same or a later engine version than the source:

  • Version order: 2019 > 2017 > 2016 > 2012 > 2008 R2 > 2005

  • Edition order: Enterprise Edition (Developer) > Standard Edition > Web > Express

The following table shows which source editions can migrate to which destination editions:

Source editionSupported destination edition
Developer, Standard, Web, ExpressEnterprise Edition
Standard, Web, ExpressStandard Edition
Web, ExpressWeb

Different RDS instance types also support different numbers of databases. Make sure the number of databases you migrate does not exceed the limit.

Other limitations

  • During migration, data can be written incrementally to the source database. Stop writing data before the workload switchover to prevent inconsistency.

  • The RDS instance is temporarily unavailable during incremental migration. Switch over workloads only after incremental migration completes.

  • Database backups are not available while a physical migration task is in progress. To back up databases during migration, enable COPY_ONLY.

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

  • FILESTREAM and FileTables columns cannot be migrated.

  • Memory-optimized tables cannot be migrated.

  • In-memory online transaction processing (OLTP) and database mirroring are incompatible. If in-memory databases are enabled on the source, the destination cannot be an instance running RDS High Availability Edition.

Scenario 1: Self-managed database with Internet access

Step 1: Install the backup gateway on the database server

The DBS backup gateway (AliyunDBSAgent) connects the source database to DTS. Install it on the server where the source database runs.

Preparations

Before you install:

Grant the sysadmin role to the NT AUTHORITY\SYSTEM account, which is the default startup account for AliyunDBSAgent:

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

Usage notes

Usage notes:

  • Install the backup gateway in the same region as the destination RDS instance.

  • AliyunDBSAgent sets the recovery model of the migrated database to Full. If data is continuously written to the database, this may exhaust disk space. After migration completes, run the following command to reset the recovery model:

    ALTER DATABASE <database_name> SET RECOVERY Simple;

Install the backup gateway:

  1. Go to the DTS console.

  2. In the left-side navigation pane, click Data Migration and select a region.

  3. Click Create Task. On the Configure Source And Destination Databases page, select SQL Server > Physical Protocol, then click Create Physical Protocol Gateway.

  4. In the Installation Command dialog box, configure Region Of Backup Gateway and Network Type Of Backup Gateway, then copy the installation command and download the installation package.

    Select Public Network to access the gateway over the Internet. Select ECS Private Network/VPC to access the gateway over an Alibaba Cloud Express Connect circuit.
  5. Install the DBS backup gateway (AliyunDBSAgent) on the Windows database server: To verify the installation, check the log file at C:\Program Files\aliyun\dbs_agent\logs\agent.log. A heartbeat message similar to the following confirms success:

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

    2. Select an installation language, click OK

    3. Accept the terms of the agreement and click Next.

    4. Select DBS Backup Gateway and click Next.

    5. Select an installation directory, click Next, then click OK.

    6. Select Backup Gateway Region, enter the AccessKey ID and AccessKey Secret, then click Next. > Important: > - The gateway region must match the region of the destination RDS instance. > - The AccessKey pair is stored in plaintext in .\config\dbs-agent.conf in the installation directory.

    7. Confirm the component package and click Next. Installation takes 1–5 minutes.

    8. Click Done.

    Gateway process heartbeat

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

  7. Verify that the backup gateway service is running:

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

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

    The system starts the backup gateway by default. You can also start and stop AliyunDBSAgent in the service manager.
  8. View the new backup gateway in the Data Disaster Recovery (DBS) console:

    To go to the Backup Gateways page of the Data Disaster Recovery console, perform the following steps:

    1. Log on to Data Management (DMS) 5.0Data Management (DMS) 5.0Data Management (DMS) 5.0.

    2. Click the DMS icon icon in the upper-left corner and choose All Features > Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Gateway. > Note: In DMS normal mode, choose Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Gateway in the top navigation bar.

    3. Click Refresh in the upper-right corner. The new gateway appears with a name that starts with DTS_.

Step 2: Create a DTS migration task

  1. Go to the DTS console.

  2. In the left-side navigation pane, click Data Migration and select a region.

  3. Click Create Task and configure the source and destination databases:

    SectionParameterDescription
    (General)Task NameEnter a name that identifies the task. The name does not need to be unique.
    Source DatabaseSelect Existing ConnectionIf the source database is already saved in Database Connection Management, select it from the list to skip manual entry.
    Database TypeSelect SQL Server.
    Access MethodSelect Physical Protocol.
    Instance RegionThe region where the source database resides.
    Physical Protocol Gateway (DBS Backup Gateway)

    Select the backup gateway installed in Step 1.

    Domain Name Or IPDefault: localhost.
    PortThe SQL Server port. Default: 1433.
    Destination DatabaseSelect Existing ConnectionIf the destination instance is already saved in Database Connection Management, select it from the list.
    Database TypeDefault: SQL Server.
    Access MethodDefault: Alibaba Cloud Instance.
    Instance RegionThe region where the RDS instance resides.
    Instance IDThe ID of the RDS for SQL Server instance.
    Database AccountAn account with read and write permissions. See Create an account and modify permissions as needed.
    Database PasswordThe password for the database account.
    Connection MethodSelect Non-encrypted if Secure Sockets Layer (SSL) encryption is disabled; select SSL-encrypted if SSL is enabled. DTS automatically trusts the server certificate.
  4. Click Test Connectivity and Proceed.

    Important

    Add the CIDR blocks of DTS servers to the whitelist of the source database before proceeding. See Add the CIDR blocks of DTS servers. Adding external CIDR blocks carries security risks — enhance password strength and restrict port access accordingly.

  5. Configure migration objects:

    ParameterDescription
    Task StagesSelect Full Data Migration for a one-time migration. To minimize downtime, also select Incremental Data Migration. If you skip incremental migration, stop writing data to the source database during migration to preserve consistency.
    Source ObjectsSelect the databases or tables to migrate. Click 向右小箭头 to move them to Selected Objects. You can migrate a single database, multiple databases, or the entire instance.
    Selected ObjectsThe objects selected for migration.
  6. Click Next: Advanced Settings and configure:

    ParameterDescription
    Monitoring and AlertingSelect Yes to receive notifications when the task fails or migration latency exceeds the threshold. Configure the alert threshold and notification settings as described in Configure monitoring and alerting.
    Retry Time For Failed ConnectionsHow long DTS retries failed connections before the task fails. Valid values: 10–1,440 minutes. Default: 720 minutes. Set this to more than 30 minutes. If multiple tasks share the same source or destination, the most recently set value applies. DTS charges continue during retries. We recommend that you release the DTS instance at the earliest opportunity after the source database and destination instance are released.
  7. Click Next: Save Task Settings and Precheck.

    - DTS runs a precheck before starting. The migration task starts only after the precheck passes. - If the precheck fails, click View Details next to the failed item, fix the issue, and run the precheck again. - For alert items that can be safely ignored, click View Alert Details > Confirm And Ignore > OK > Run Precheck Again. Ignoring alerts may cause data inconsistency.
  8. When Success Rate reaches 100%, click Next: Purchase Instance.

  9. On the Purchase page, accept the Data Transmission Service (Pay-as-you-go) Terms Of Service and click Buy And Start. Confirm in the dialog box. To monitor progress, click the migration task on the Data Migration page and view the Task Management page.

    You can also track full and incremental migration progress on the Backup And Restoration > Backup Data Upload History page of the destination instance in the RDS console.
  10. When full migration reaches 100% and incremental migration is running, go to the Task Management > Incremental Migration page and click Migrate To Cloud.

  11. In the Are You Sure You Want To Migrate To The Cloud dialog box, click Switch Now and wait for the task to complete.

    Important

    Stop writing data to the source database before triggering the switchover to prevent data inconsistency. The switchover takes several minutes.

Scenario 2: Self-managed database without Internet access (bastion host)

In this scenario, a proxy gateway on the bastion host forwards data between the database server and DTS cloud storage. The database server itself has no direct Internet access.

Step 1: Install the proxy gateway on the bastion host

Install the proxy gateway on the bastion host first. The backup gateway on the database server (Step 2) routes through this proxy.

Before you install:

Grant the sysadmin role to the NT AUTHORITY\SYSTEM account:

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

Usage notes

Usage notes:

  • Install the proxy gateway and backup gateway in the same region as the destination RDS instance.

  • AliyunDBSAgent sets the recovery model of the migrated database to Full. After migration completes, reset it if needed:

    ALTER DATABASE <database_name> SET RECOVERY Simple;

Windows bastion host

  1. Go to the DTS console.

  2. In the left-side navigation pane, click Data Migration and select a region.

  3. Click Create Task. On the Configure Source And Destination Databases page, select SQL Server > Physical Protocol, then click Create Physical Protocol Gateway.

  4. In the Installation Command dialog box, configure Region Of Backup Gateway and Network Type Of Backup Gateway, then copy the installation link and download the installation package.

    Important

    - Save this download link separately — you need it again in Step 2 to install the backup gateway on the database server. - Select Public Network for Internet access or ECS Private Network/VPC for Express Connect access.

  5. Install the proxy gateway on the Windows bastion host:

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

    2. Select an installation language and click OK.

    3. Click Next.

    4. Accept the terms of the agreement and click Next.

    5. Select Proxy Gateway and click Next.

    6. Select an installation path and click Next, then click Yes. > Note: The default installation path is C:\Program Files (x86)\aliyun\dbs_agent.

    7. Click Next to install the proxy gateway base file.

    8. After the base file installs, click Next > Done.

  6. Open Task Manager in Windows to verify that the proxy gateway process is running.

  7. Proceed to Step 2 to install the backup gateway on the database server.

Linux bastion host

  1. Log on to Data Management (DMS) 5.0Data Management (DMS) 5.0Data Management (DMS) 5.0.

  2. Click the DMS icon icon in the upper-left corner and choose All Features > Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Gateway.

    In DMS normal mode, choose Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Gateway in the top navigation bar.
  3. Click Install Backup Gateway in the upper-right corner.

  4. Select Network Type Of Backup Gateway, copy the installation command, and save the download link separately — you need it in Step 2.

    Important

    Select Public Network for Internet access or ECS Private Network/VPC for Express Connect access.

  5. Run the installation command on the Linux bastion host. The system downloads and runs the installation package:

    1. Select an installation language (0 for Chinese, 1 for English).

    2. Enter 1 to read the gateway protocol, then 1 to accept it.

    3. Select the component to install. Enter N to install a proxy gateway (DG), then Y to confirm. `` Enter Y for Yes, N for No: N -- DG -- Enter Y for Yes, N for No: Y Done! ``

    4. Enter 1 to continue.

    5. Select an installation path. Press Enter to use the default /usr/local/aliyun/dbs_agent, or enter a custom path.

    6. Enter 1 to start the installation. Installation takes 1–5 minutes.

    [root@iZbp****** ~]# wget -O aliyunDBSAgentInstaller.jar https://aliyun-dbs.oss-cn-hangzhou-internal.aliyuncs.com/installer/0.0.141/aliyunDBSAgentInstaller-0.0.141.jar && sudo java -Dregion=cn-hangzhou -jar aliyunDBSAgentInstaller.jar

    Follow the interactive prompts:

  6. Verify that the proxy gateway is running:

    ps aux | grep app_aliyun_proxy

    The following output confirms the proxy gateway is installed and running:

    root     1****  0.0  0.5 7*****  9*** ?        Ssl  16:06   0:00 /usr/local/aliyun/daili_dbs_agent/dist/app_aliyun_proxy/app_aliyun_proxy -addr :9797 -logdir /usr/local/aliyun/daili_dbs_agent/logs

    If you encounter an error you cannot resolve, contact support via the Data Disaster Recovery DingTalk group (group ID: 35585947).

  7. Proceed to Step 2 to install the backup gateway on the database server.

Step 2: Install the backup gateway on the database server

Install the DBS backup gateway on the server where the source database runs. During installation, point the gateway to the proxy gateway on the bastion host.

Important

Use the same download link you saved in Step 1. Using a different link causes the database server to fail to connect through the proxy.

  1. Copy the gateway download link from Step 1 and download the package on the database server.

  2. Install the DBS backup gateway (AliyunDBSAgent): To verify the installation, check C:\Program Files\aliyun\dbs_agent\logs\agent.log. A heartbeat message confirms success:

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

    2. Select an installation language, click OK, then click Next.

    3. Accept the terms of the agreement and click Next.

    4. Select DBS Backup Gateway and click Next.

    5. Select an installation directory, click Next, then click OK.

    6. Select Agent Region, and enter the AccessKey ID, AccessKey Secret, Proxy Gateway Address, and Proxy Gateway Port (default: 9797). Click Next. > Important: > - The gateway region must match the region of the destination RDS instance. > - The AccessKey pair is stored in plaintext in .\config\dbs-agent.conf. > - For Proxy Gateway Address, enter the internal IP address of the bastion host. After you complete this step, the system connects to the proxy gateway. If the connection fails, check the proxy gateway installation.

    7. Confirm the component package and click Next. Installation takes 1–5 minutes.

    8. Click Done.

    Gateway process heartbeat

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

  4. Verify that the backup gateway service is running:

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

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

  5. View the new backup gateway in the DBS console:

    To go to the Backup Gateways page of the Data Disaster Recovery console, perform the following steps:

    1. Log on to Data Management (DMS) 5.0Data Management (DMS) 5.0Data Management (DMS) 5.0.

    2. Click the DMS icon icon and choose All Features > Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Gateway.

    3. Click Refresh. The new gateway appears with a name starting with DTS_.

Step 3: Create a DTS migration task

  1. Go to the DTS console.

  2. In the left-side navigation pane, click Data Migration and select a region.

  3. Click Create Task and configure the source and destination databases:

    SectionParameterDescription
    (General)Task NameEnter a name that identifies the task.
    Source DatabaseSelect Existing ConnectionIf the source database is already saved in Database Connection Management, select it to skip manual entry.
    Database TypeSelect SQL Server.
    Access MethodSelect Physical Protocol.
    Instance RegionThe region where the source database resides.
    Physical Protocol Gateway (DBS Backup Gateway)

    Select the backup gateway installed in Step 2.

    Domain Name Or IPDefault: localhost.
    PortThe SQL Server port. Default: 1433.
    Destination DatabaseSelect Existing ConnectionIf the destination instance is already saved, select it to skip manual entry.
    Database TypeDefault: SQL Server.
    Access MethodDefault: Alibaba Cloud Instance.
    Instance RegionThe region where the RDS instance resides.
    Instance IDThe ID of the RDS instance.
    Database AccountAn account with read and write permissions. See Create an account and modify permissions as needed.
    Database PasswordThe password for the account.
    Connection MethodSelect Non-encrypted if SSL is disabled; select SSL-encrypted if SSL is enabled. DTS trusts the server certificate by default.
  4. Click Test Connectivity and Proceed.

    Important

    Add the IP addresses of DTS servers to the whitelist of the source database. See Add the CIDR blocks of DTS servers. Restrict port access and strengthen passwords to reduce security exposure.

  5. Select migration objects:

    ParameterDescription
    Task StagesSelect Full Data Migration for a one-time migration. To minimize downtime, also select Incremental Data Migration. If you skip incremental migration, stop writing data to the source database during migration.
    Source ObjectsSelect the databases or tables to migrate and click 向右小箭头 to add them to Selected Objects.
    Selected ObjectsThe objects selected for migration.
  6. Click Next: Advanced Settings:

    ParameterDescription
    Monitoring and AlertingSelect Yes to receive failure or latency alerts. Configure thresholds and notifications as described in Configure monitoring and alerting.
    Retry Time For Failed ConnectionsHow long DTS retries failed connections. Valid values: 10–1,440 minutes. Default: 720 minutes. Set this to more than 30 minutes. If multiple tasks share the same source or destination, the most recently set value applies. DTS charges continue during retries. We recommend that you release the DTS instance at the earliest opportunity after the source database and destination instance are released.
  7. Click Next: Save Task Settings and Precheck.

    - The task starts only after the precheck passes. - If the precheck fails, click View Details, fix the issue, and rerun the precheck. - For alerts that can be safely ignored, click View Alert Details > Confirm Ignore > OK > Run Precheck Again.
  8. When Success Rate reaches 100%, click Next: Purchase Instance.

  9. Accept the Data Transmission Service (Pay-as-you-go) Terms Of Service and click Buy And Start. Confirm in the dialog box.

  10. When full migration reaches 100% and incremental migration is running, go to the Task Management > Incremental Migration page and click Migrate To Cloud.

  11. In the Do You Want To Migrate To Cloud dialog box, click Start Now and wait for the task to complete.

    Important

    Stop writing data to the source database before triggering the switchover. The switchover takes several minutes.

Appendix: Physical gateway migration vs. logical migration

ItemPhysical gateway migrationLogical migration
Migration principleUses the native physical backup protocol to write data as blocksUses JDBC to capture SQL statements and write them to the destination
OS requirementWindows only (desktop: Windows XP or later; server: Windows Server 2003 or later)No limits
Gateway requiredYes — install on the database serverNo
Network connectivityWhether the server on which the self-managed database is deployed can connect to the network of Alibaba Cloud. Suitable solutions are provided based on the current network status: Scenario 1 (direct Internet access) or Scenario 2 (bastion host).The port to connect to the database must be enabled, or leased line-based connections must be established.
Source database permissionssysadmin roleSELECT for schema and full migration; sysadmin for incremental migration. See Required permissions
Version requirementDestination must be the same or a later version than the sourceSupports both upgrades and downgrades
Destination availability during migrationDestination is inaccessibleRead and write operations are available
Table type limitsMemory-optimized tables, FILESTREAM, and FileTables cannot be migratedSee Source database limits
Migration sourceSelf-managed databases (ECS, data center, or third-party cloud)Self-managed and cloud-hosted databases
Migration efficiencyHighMedium
Extract, transform, load (ETL) supportNot supportedSupported
Table-level data filteringNot supportedSupported
Database-level data filteringSupportedSupported