Data Transmission Service (DTS) supports real-time data synchronization from ApsaraDB RDS for MySQL instances to self-managed Oracle databases. This topic describes how to configure a synchronization task using a self-managed Oracle database hosted on Elastic Compute Service (ECS) as the destination. The steps for other supported source and destination types are similar.
Supported source and destination databases
| Source database | Destination database |
|---|---|
| ApsaraDB RDS for MySQL instance | Self-managed Oracle connected over Express Connect, VPN Gateway, or Smart Access Gateway |
| Self-managed MySQL on ECS | Self-managed Oracle on ECS |
| Self-managed MySQL connected over Express Connect, VPN Gateway, or Smart Access Gateway | Self-managed Oracle connected over Database Gateway |
| Self-managed MySQL connected over Database Gateway | Self-managed Oracle connected over Cloud Enterprise Network (CEN) |
| Self-managed MySQL connected over Cloud Enterprise Network (CEN) |
Billing
| Synchronization type | Billing |
|---|---|
| Schema synchronization and full data synchronization | Free of charge |
| Incremental data synchronization | Charged. For pricing details, see Billing overview. |
Supported synchronization topologies
One-way one-to-one synchronization
One-way one-to-many synchronization
One-way many-to-one synchronization
SQL operations that can be synchronized
| Type | Operations |
|---|---|
| DML | INSERT, UPDATE, DELETE |
| DDL | CREATE TABLE, ALTER TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE |
| DDL | ADD COLUMN, DROP COLUMN, MODIFY COLUMN, RENAME COLUMN |
| DDL | CREATE INDEX, UNIQUE INDEX, DROP INDEX |
Prerequisites
Before you begin, ensure that you have:
Enabled ARCHIVELOG mode on the destination Oracle database, with archived log files accessible and an appropriate retention period set. For details, see Managing archived redo log files.
Enabled supplemental logging on the destination Oracle database, with
SUPPLEMENTAL_LOG_DATA_PKandSUPPLEMENTAL_LOG_DATA_UIset toYes. For details, see Supplemental logging.(Oracle RAC only) Connected the Oracle RAC database to an Alibaba Cloud virtual private cloud (VPC), with routing rules configured so that each Single Client Access Name (SCAN) IP and the virtual IP address (VIP) of each node can reach the VPC. For details, see Connect an on-premises database to Alibaba Cloud and Connect a data center to DTS by using VPN Gateway.
Limitations
Review these limitations before configuring the task. Ignoring them may cause task failure or data inconsistency.
Source database
Tables must have a primary key or unique key constraint. All fields must be unique. Without this, the destination database may contain duplicate records.
Binary logging must be correctly configured:
For ApsaraDB RDS for MySQL: binary logging is enabled by default. Set
binlog_row_imagetofull. If this parameter is not set correctly, the precheck fails and the task cannot start. For details, see Modify instance parameters.For self-managed MySQL: enable binary logging, set
binlog_formattorow, and setbinlog_row_imagetofull.For self-managed MySQL in a dual-primary cluster: also set
log_slave_updatestoONto make sure DTS can obtain all binary logs. For details, see Create an account for a self-managed MySQL database and configure binary logging.
Binary log retention must meet minimum requirements. If binary logs are purged before DTS reads them, the task fails and data inconsistency or loss may occur:
ApsaraDB RDS for MySQL: retain binary logs for at least 3 days (7 days recommended). For details, see the Delete binary log files section in "Manage binary log files".
Self-managed MySQL: retain binary logs for at least 7 days.
Object count limit when synchronizing individual tables with edits: If you select tables as objects to synchronize and want to rename tables or columns, a single task supports up to 1,000 tables. For more than 1,000 tables, configure multiple tasks or synchronize the entire database instead.
Do not run DDL statements during schema synchronization or full data synchronization. Doing so causes the task to fail.
MySQL 8.0.23 or later: invisible columns are not synchronized. If the source includes invisible columns, data loss occurs. To make a column visible, run:
ALTER TABLE <table_name> ALTER COLUMN <column_name> SET VISIBLE;For tables without a primary key, MySQL 8.0.23 or later automatically generates an invisible primary key. Make the invisible primary key visible before starting the synchronization task. For details, see Invisible columns and Generated invisible primary keys.
Data generated by physical backup restores or cascade operations is not synchronized. If unsynchronized data causes issues, remove the affected tables from the synchronization objects, then re-add them. For details, see Modify the objects to be synchronized.
Cascaded UPDATE or DELETE operations may cause data inconsistency during full data synchronization and incremental data synchronization. DTS does not capture the cascaded changes on child tables triggered by parent table operations.
Destination database
Disable foreign keys and triggers on the destination database before starting the task. If either is active during full data synchronization and incremental data synchronization, the synchronization task may fail.
Oracle RAC as destination: use a single VIP, not the SCAN IP. After specifying the VIP, node failover is not supported for the Oracle RAC database.
Other limitations
At most one column attribute can be changed.
Basic data types cannot be changed.
ApsaraDB RDS for MySQL with EncDB enabled: full data synchronization is not supported.
ApsaraDB RDS for MySQL with Transparent Data Encryption (TDE) enabled: schema synchronization, full data synchronization, and incremental data synchronization are all supported.
If a DTS task fails, DTS technical support attempts to restore it within 8 hours. During restoration, the task may be restarted and task parameters may be modified (database parameters are not modified). The parameters that may be modified include but are not limited to the parameters in the Modify instance parameters section of the Modify the parameters of a DTS instance topic.
Special cases
Self-managed MySQL: a primary/secondary switchover during the task causes failure. Plan switchovers around the synchronization task window.
Read-only ApsaraDB RDS for MySQL 5.6 (no transaction logs) cannot be used as a source.
Synchronization latency may be inaccurate when no DML operations occur on the source. If the reported latency is too high, perform a DML operation on the source to update it. To maintain accurate latency automatically, create a heartbeat table (updated every second) when synchronizing an entire database.
DTS periodically executes `CREATE DATABASE IF NOT EXISTS 'test'` on the source to advance the binary log file position. This applies to both ApsaraDB RDS for MySQL and self-managed MySQL sources.
Configure a synchronization task
Step 1: Go to the Data Synchronization page
Use one of the following methods:
DTS console
Log on to the DTS console.
In the left-side navigation pane, click Data Synchronization.
In the upper-left corner, select the region where the synchronization instance resides.
DMS console
The actual operations may vary based on the mode and layout of the DMS console. For details, see Simple mode and Customize the layout and style of the DMS console.
Log on to the DMS console.
In the top navigation bar, move the pointer over Data + AI and choose DTS (DTS) > Data Synchronization.
From the drop-down list next to Data Synchronization Tasks, select the region where the synchronization instance resides.
Step 2: Configure source and destination databases
Click Create Task.
Configure the parameters described in the following tables.
General
| Parameter | Description |
|---|---|
| Task Name | DTS auto-generates a name. Specify a descriptive name to make the task easy to identify. The name does not need to be unique. |
Source database
| Parameter | Value / description |
|---|---|
| Database Type | Select MySQL. |
| Access Method | Select Alibaba Cloud Instance. |
| Instance Region | Select the region where the source ApsaraDB RDS for MySQL instance resides. |
| Replicate Data Across Alibaba Cloud Accounts | Select No (same Alibaba Cloud account). |
| RDS Instance ID | Select the ID of the source ApsaraDB RDS for MySQL instance. |
| Database Account | Enter the database account of the source instance. |
| Database Password | Enter the password for the database account. |
| Encryption | Select Non-encrypted or SSL-encrypted. To use SSL encryption, enable SSL on the RDS instance before configuring this task. For details, see Use a cloud certificate to enable SSL encryption. |
Destination database
| Parameter | Value / description |
|---|---|
| Database Type | Select Oracle. |
| Access Method | Select Self-managed Database On ECS. |
| Instance Region | Select the region where the destination Oracle database resides. |
| ECS Instance ID | Select the ID of the ECS instance that hosts the Oracle database. |
| Port Number | Enter the service port of the Oracle database. Default: 1521. |
| Oracle Type | Select Non-RAC Instance (requires SID) or RAC Or PDB Instance (requires Service Name). |
| Database Account | Enter the account of the self-managed Oracle database. |
| Database Password | Enter the password for the database account. |
Click Test Connectivity and Proceed. In the CIDR Blocks of DTS Servers dialog box, click Test Connectivity.
Make sure the CIDR blocks of DTS servers are added to the security settings of both the source and destination databases. For details, see Add the CIDR blocks of DTS servers.
Step 3: Configure objects to synchronize
In the Configure Objects step, configure the following parameters.
| Parameter | Description |
|---|---|
| Synchronization Types | Select Schema Synchronization, Full Data Synchronization, and Incremental Data Synchronization. Full data synchronization copies historical data to the destination as the baseline for incremental synchronization. Incremental Data Synchronization is selected by default. |
| Processing Mode of Conflicting Tables | Precheck and Report Errors: checks for tables with identical names in source and destination. If identical names exist, the precheck fails. To resolve conflicts without deleting or renaming destination tables, use the object name mapping feature. For details, see Map object names. Ignore Errors and Proceed: skips the precheck for identical table names. > Warning Selecting this option may cause data inconsistency. During full synchronization, records with conflicting primary or unique keys are skipped; during incremental synchronization, they overwrite destination records. If schemas differ, initialization may partially fail. |
| Capitalization of Object Names in Destination Instance | Specifies the capitalization of database, table, and column names in the destination. Default: DTS default policy. For details, see Specify the capitalization of object names. |
| Source Objects | Select one or more objects and click the right-arrow icon to move them to Selected Objects. You can select columns, tables, or databases. Selecting tables or columns excludes views, triggers, and stored procedures. |
| Selected Objects | To rename a single object, right-click it. To rename multiple objects at once, click Batch Edit. For details, see Map object names. To filter data with a WHERE condition, right-click a table and configure the condition. For details, see Configure SQL conditions to filter data. Note If you rename an object, other objects that depend on it may fail to synchronize. |
Click Next: Advanced Settings and configure the following parameters.
| Parameter | Description |
|---|---|
| Dedicated Cluster for Task Scheduling | DTS schedules the task to the shared cluster by default. For higher stability, purchase a dedicated cluster. For details, see What is a DTS dedicated cluster. |
| Retry Time for Failed Connections | The retry window when the source or destination database is unreachable after the task starts. Valid values: 10–1440 minutes. Default: 720 minutes. Set to more than 30 minutes. If the connection is restored within this window, DTS resumes the task; otherwise, the task fails. Note If multiple tasks share the same source or destination database, the shortest retry window applies. DTS charges for the instance during retries. |
| Retry Time for Other Issues | The retry window for DDL or DML operation failures after the task starts. Valid values: 1–1440 minutes. Default: 10 minutes. Set to more than 10 minutes. This value must be less than the Retry Time for Failed Connections value. |
| Enable Throttling for Full Data Synchronization | Limits read/write resource usage during full synchronization to reduce load on source and destination servers. Configure Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s). Available only when Full Data Synchronization is selected. |
| Enable Throttling for Incremental Data Synchronization | Limits resource usage during incremental synchronization. Configure RPS of Incremental Data Synchronization and Data synchronization speed for incremental synchronization (MB/s). |
| Environment Tag | Attach an environment tag to the synchronization instance for identification. |
| Configure ETL | Select Yes to enable extract, transform, and load (ETL) and enter data processing statements. Select No to skip. For details, see What is ETL? and Configure ETL in a data migration or data synchronization task. |
| Monitoring and Alerting | Select Yes to receive notifications when the task fails or synchronization latency exceeds the threshold. Configure the alert threshold and notification settings. For details, see Configure monitoring and alerting. |
Click Next Step: Data Verification to configure data verification. For details, see Configure a data verification task.
Step 4: Run the precheck
Click Next: Save Task Settings and Precheck.
To view the API parameters for this configuration, hover over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters.
Wait for the precheck to complete.
If an item fails, click View Details, fix the issue, then click Precheck Again.
If an item returns an alert that can be ignored, click Confirm Alert Details, then click Ignore > OK > Precheck Again. Ignoring alert items may cause data inconsistency.
Step 5: Purchase and start the instance
Wait until Success Rate reaches 100%, then click Next: Purchase Instance.
On the buy page, configure the following parameters.
| Parameter | Description |
|---|---|
| Billing Method | Subscription: pay upfront for a fixed term; more cost-effective for long-term use. Pay-as-you-go: billed hourly; suitable for short-term use. Release the instance when no longer needed to stop charges. |
| Resource Group Settings | The resource group for the synchronization instance. Default: default resource group. For details, see What is Resource Management? |
| Instance Class | Select an instance class based on your required synchronization speed. For details, see Instance classes of data synchronization instances. |
| Subscription Duration | Available only for the Subscription billing method. Options: 1–9 months, or 1, 2, 3, or 5 years. |
Read and select Data Transmission Service (Pay-as-you-go) Service Terms.
Click Buy and Start, then click OK in the dialog box.
The task appears in the task list. Monitor its progress from there.