Use Data Transmission Service (DTS) to migrate databases between ApsaraDB RDS for SQL Server instances with minimal or zero downtime. DTS supports three migration types — schema migration, full data migration, and incremental data migration — which you can combine to match your downtime tolerance.
Required permissions
Make sure the database accounts for the source and destination instances have the following permissions. To create or modify accounts, see create an account and modify account permissions.
| Database | Schema migration | Full migration | Incremental migration |
|---|---|---|---|
| Source instance | Read | Read | Owner on objects to be migrated |
| Destination instance | Read and write | Read and write | Read and write |
Limitations and usage notes
Review all limitations before configuring the migration task. Ignoring them can cause task failure, data inconsistency, or data loss.
Scale limits
A single migration task supports up to 10 databases. Exceeding this limit causes stability and performance issues. Split databases across multiple tasks if needed.
For incremental migration, keep the number of tables from the source database below 1,000. Exceeding this causes task latency or instability.
When using object name mapping to rename tables in the destination, a single task supports up to 1,000 tables. Exceeding this causes a request error. Split the tasks or migrate the entire database instead.
Split into multiple tasks if any of the following conditions apply to the source instance:
More than 10 databases
Log backup frequency exceeds once per hour for a single database
DDL frequency exceeds 100 per hour for a single database
Log volume exceeds 20 MB/s for a single database
Table structure requirements
Tables to be migrated must have
PRIMARY KEYorUNIQUEconstraints with all unique fields. Otherwise, the destination database may contain duplicate records.If the incremental synchronization mode is set to Incremental synchronization based on logs of source database (heap tables are not supported), tables must have clustered indexes that include primary key columns. Heap tables, tables without primary keys, compressed tables, and tables with computed columns are not supported.
If the incremental synchronization mode is set to Hybrid log-based parsing, the above table structure limitations do not apply, but the Change Data Capture (CDC) jobs in the source database must be running properly.
CDC cannot be enabled for tables with clustered columnstore indexes.
DDL operation restrictions
Do not perform DDL operations (such as modifying table or database structures) during schema migration or full data migration. The task will fail.
Do not run continuous add/drop column operations during incremental migration. More than two add or drop column DDL operations within one minute can cause task failure. Keep intervals between such operations greater than 10 minutes.
DTS cannot migrate DDL operations on the primary key of a CDC-enabled table.
DTS does not migrate: transactional DDL (multi-column DDL or DDL combined with DML in a single statement), DDL with user-defined types, online DDL, DDL on objects whose names contain reserved keywords, or DDL run via system stored procedures.
Reindexing restriction
Do not perform reindexing operations during incremental data migration. The task may fail and data loss may occur.
Unsupported data types
The following data types are not supported: CURSOR, ROWVERSION, SQL_VARIANT, HIERARCHYID, POLYGON, GEOMETRY, GEOGRAPHY.
Log retention requirements
Incremental migration only: retain source database logs for more than 24 hours
Full data + incremental data migration: retain logs for at least 7 days (after full migration completes, this can be reduced to more than 24 hours)
For incremental migration tasks, the data logs of the source database must be enabled, the backup mode must be set to
Full, and a full physical backup must have completed successfully.
CDC configuration requirements
If CDC needs to be enabled on source tables, the
srvnamefield in thesys.sysserversview must match the return value of theSERVERPROPERTYfunction.If the source database is ApsaraDB RDS for SQL Server, the database owner must be sqlsa.
The CDC component retains incremental data for 3 days by default. Adjust this based on your business requirements.
If daily average incremental SQL changes for a single table exceed 10 million, set the CDC retention time to 1,440 minutes (1 day).
If a single field in a CDC-enabled table needs to write data exceeding 64 KB, run the following command on the source database before starting the task:
EXEC sp_configure 'max text repl size', -1;
Triggers and foreign keys
If the migration task includes incremental data migration, disable all triggers and foreign keys in the destination database before starting. Otherwise, the task may fail or data loss may occur.
Database naming
If the database name to be migrated does not comply with ApsaraDB RDS for SQL Server naming conventions, create the database in the destination instance manually before configuring the migration task.
Transparent Data Encryption (TDE)
If the source database is ApsaraDB RDS for SQL Server and the task includes incremental migration, disable TDE to ensure stable operation of the migration instance.
DTS system accounts
Do not delete or modify DTS system accounts (such as rdsdt_dtsacct) during task execution. The task will fail.
Task auto-resume and cutover risk
DTS automatically tries to resume migration tasks that failed within the last 7 days. Before switching workloads to the destination instance, end or release the task, or revoke the write permissions of the DTS account on the destination instance. Otherwise, data in the destination instance may be overwritten.
Other notes
Ensure the server hosting the source database has sufficient egress bandwidth. Insufficient bandwidth reduces migration speed. We recommend performing migration tasks during off-peak hours to avoid increased database loads.
For cross-version migration, check compatibility in advance. See Feature differences between ApsaraDB RDS for SQL Server versions.
During hybrid log-based parsing, DTS creates the following objects in the source database: the
dts_cdc_sync_ddltrigger, thedts_sync_progressheartbeat table, and thedts_cdc_ddl_historyDDL storage table. These cannot be manually deleted.During full data migration, enable the
READ_COMMITTED_SNAPSHOTtransaction isolation mode on the source database to avoid shared locks affecting write operations.After full data migration completes, the destination table storage may be larger than the source due to fragmentation from concurrent INSERT operations.
Incremental data migration is not supported when the source database version is ApsaraDB RDS for SQL Server 2008 or 2008 R2.
Configure the migration task
Step 1: Connect source and destination databases
Go to the Data Transmission Service (DTS) console.
In the left navigation pane, click Data Migration and select a region.
Click Create Task and configure the source and destination database connections.
Section Parameter Description — Task Name Enter a descriptive name for easy identification. Uniqueness is not required. Source Database Select Existing Connection If you previously saved connection details on the DTS Data Connection Management page, select the connection here to skip manual entry. Database Type Select SQL Server. Access Method Select Cloud Instance. Instance Region Select the region of the source ApsaraDB RDS for SQL Server instance. Replicate Data Across Alibaba Cloud Accounts Select No for migration between instances in the same Alibaba Cloud account. RDS Instance ID Select the ID of the source instance. Database Account Enter the source instance database account with the required permissions. Database Password Enter the password for the database account. Encryption Select Non-encrypted if SSL is not enabled. Select SSL-encrypted if the source database has Secure Sockets Layer (SSL) enabled — DTS trusts the server certificate by default. Destination Database Select Existing Connection If you previously saved connection details on the DTS Data Connection Management page, select the connection here to skip manual entry. Database Type Select SQL Server. Access Method Select Cloud Instance. Instance Region Select the region of the destination ApsaraDB RDS for SQL Server instance. Instance ID Select the ID of the destination instance. Database Account Enter the destination instance database account with the required permissions. Database Password Enter the password for the database account. Encryption Select Non-encrypted if SSL is not enabled. Select SSL-encrypted if the destination database has SSL enabled — DTS trusts the server certificate by default. Click Test Connectivity and Proceed.
Make sure DTS server IP address ranges are added to the security settings of both the source and destination databases. See Add the CIDR blocks of DTS servers to security settings.
Step 2: Select objects to migrate
On the Configure Objects page, configure the migration settings.
| Parameter | Description |
|---|---|
| Migration Types | Select the migration types that match your approach. For full migration: select Schema Migration and Full Data Migration. For minimal-downtime migration: select Schema Migration, Full Data Migration, and Incremental Data Migration. |
| Method to Migrate Triggers in Source Database | Select a trigger migration method based on your requirements. Skip this if the objects to migrate contain no triggers. This parameter is available only when both Schema Migration and Incremental Data Migration are selected. |
| SQL Server Incremental Synchronization Mode | Available only when Incremental Data Migration is selected. See Incremental synchronization modes for a comparison. |
| The maximum number of tables for which CDC is enabled that DTS supports | Set the maximum number of CDC-enabled tables for the current migration instance. Default: 1,000. Not available when the synchronization mode is Incremental synchronization based on logs of source database (heap tables are not supported). |
| Processing Mode of Conflicting Tables | Precheck and Report Errors (default): DTS checks for tables in the destination with the same names as the source. The task only starts if no conflicts are found. Ignore Errors and Proceed: Skips this check. During full migration, DTS keeps existing records in the destination and skips conflicting source records. During incremental migration, new source data may overwrite destination data, causing data loss. Use with caution. |
| Source Objects | Select the objects to migrate and click the arrow icon to move them to Selected Objects. Selecting tables or columns excludes other object types such as views, triggers, and stored procedures. |
| Selected Objects | To rename a single object in the destination, right-click it. See Map the name of a single object. To rename multiple objects, click Batch Edit. See Map multiple object names at a time. To filter rows by condition, right-click a table and configure a filter condition. |
Renaming an object may cause dependent objects to fail migration.
Step 3: Configure advanced settings
Click Next: Advanced Settings and configure the following options.
| Parameter | Description |
|---|---|
| Dedicated Cluster for Task Scheduling | By default, DTS uses the shared cluster. For higher stability, purchase a dedicated cluster. See What is a DTS dedicated cluster. |
| Retry Time for Failed Connections | How long DTS retries failed connections after the task starts. Valid values: 10–1,440 minutes. Default: 720. Set to a value greater than 30. During retries, you are charged for the DTS instance. |
| Retry Time for Other Issues | How long DTS retries failed DDL or DML operations. Valid values: 1–1,440 minutes. Default: 10. Set to a value greater than 10. Must be smaller than Retry Time for Failed Connections. |
| Enable Throttling for Full Data Migration | Limits read/write resource usage during full data migration to reduce database load. Configure QPS (queries per second) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s). Available only when Full Data Migration is selected. |
| Enable Throttling for Incremental Data Migration | Limits resource usage during incremental migration. Configure RPS of Incremental Data Migration and Data migration speed for incremental migration (MB/s). Available only when Incremental Data Migration is selected. |
| Environment Tag | An optional tag to identify the DTS instance by environment. |
| Configure ETL | Select Yes to configure extract, transform, and load (ETL) processing. See Configure ETL in a data migration or data synchronization task. Select No to skip. |
| Monitoring and Alerting | Select Yes to receive alerts when the task fails or latency exceeds a threshold. Configure the alert threshold and notification contacts. See Configure monitoring and alerting. |
Step 4: Configure data verification (optional)
Click Next Step: Data Verification to set up a data verification task. See Configure a data verification task.
Step 5: Run the precheck and purchase an instance
Click Next: Save Task Settings and Precheck.
To preview the API parameters for this task configuration, hover over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters.
Wait for the precheck to complete. If any items fail, click View Details, troubleshoot the issues, and run the precheck again. If an item triggers an alert that can be ignored, click Confirm Alert Details > Ignore > OK, then click Precheck Again. Ignoring alerts may result in data inconsistency.
When Success Rate reaches 100%, click Next: Purchase Instance.
On the Purchase Instance page, configure the instance class.
Parameter Description Resource Group The resource group for the migration instance. Default: default resource group. See What is Resource Management? Instance Class Select an instance class based on the required migration speed. See Instance classes of data migration instances. Accept the Data Transmission Service (Pay-as-you-go) Service Terms and click Buy and Start. In the confirmation dialog, click OK.
Monitor the task
View task progress on the Data Migration page.
Tasks without incremental data migration stop automatically when complete. The status shows Completed.
Tasks with incremental data migration run continuously and do not stop automatically. The status shows Running.
Incremental synchronization modes
This section applies when Incremental Data Migration is selected as a migration type.
| Mode | Advantages | Disadvantages | Use when |
|---|---|---|---|
| Hybrid log-based parsing (Log-based parsing for non-heap tables and CDC-based incremental synchronization for heap tables) | Supports heap tables, tables without primary keys, compressed tables, and tables with computed columns. Provides a wider variety of DDL statements. | DTS creates dts_cdc_sync_ddl trigger, dts_sync_progress heartbeat table, and dts_cdc_ddl_history DDL storage table in the source database. Enables database-level and table-level CDC. SELECT INTO, TRUNCATE, and RENAME COLUMN cannot be run on CDC-enabled tables. Source database triggers created by DTS cannot be manually deleted. | Source tables include heap tables, tables without primary keys, or compressed or computed-column tables. Supported source editions: Enterprise or Enterprise Evaluation (2012, 2014, 2016, 2019, 2022), Standard (2016, 2019, 2022). |
| Incremental synchronization based on logs of source database (heap tables are not supported) | No changes are made to the source database. | Does not support heap tables, tables without primary keys, compressed tables, or tables with computed columns. | Source is a web edition of RDS for SQL Server (this mode is required). Source tables meet all structural requirements. |
| Polling and querying CDC instances for incremental synchronization | Supports migration from Amazon RDS for SQL Server, Azure SQL Database, Azure SQL Managed Instance, Azure SQL Server on Virtual Machine, and Google Cloud SQL for SQL Server. Uses the native CDC component of SQL Server for stable incremental migration with lower network bandwidth usage. | The DTS account must have permission to enable CDC. Incremental migration has a latency of approximately 10 seconds. Stability and performance issues may occur when migrating many databases and tables simultaneously. | Source is a third-party cloud SQL Server instance outside Alibaba Cloud. |
Appendix: SQL operations supported for incremental migration
DML operations
INSERT, UPDATE, DELETE
DTS does not migrate UPDATE statements that only update large object (LOB) fields.
DDL operations
ALTER TABLE— supportsADD COLUMN,DROP COLUMN, andRENAME COLUMNonlyCREATE TABLE,CREATE INDEXCREATE TABLEdoes not support partitions or functions within table definitions.DROP TABLERENAME TABLE
The following DDL operations are not migrated:
Transactional DDL (multi-column DDL or DDL combined with DML in a single statement) — data loss may occur
DDL with user-defined types
Online DDL
DDL on objects whose names contain reserved keywords
DDL run via system stored procedures
TRUNCATE TABLE