All Products
Search
Document Center

Data Management:Synchronize shadow tables

Last Updated:Mar 28, 2026

Shadow table synchronization in Data Management (DMS) automatically creates shadow tables in a database based on the schema of source tables. Shadow tables mirror the structure of their source tables but are named with a configurable prefix or suffix, making them safe to use for end-to-end stress testing without affecting production data. DMS supports one-time and scheduled synchronization.

Prerequisites

Before you begin, ensure that you have:

  • A source database of one of the following types:

    • MySQL: ApsaraDB RDS for MySQL, PolarDB for MySQL, ApsaraDB MyBase for MySQL, PolarDB-X, AnalyticDB for MySQL V3.0, and MySQL databases from other sources

    • SQL Server: ApsaraDB RDS for SQL Server, ApsaraDB MyBase for SQL Server, and SQL Server databases from other sources

    • PostgreSQL: ApsaraDB RDS for PostgreSQL, PolarDB for PostgreSQL, ApsaraDB MyBase for PostgreSQL, AnalyticDB for PostgreSQL, and PostgreSQL databases from other sources

    • MariaDB: ApsaraDB RDS for MariaDB and MariaDB databases from other sources

    • ApsaraDB for OceanBase in MySQL mode

    • PolarDB for PostgreSQL (Compatible with Oracle)

  • Query and change permissions on the source database. See View owned permissions

  • The Enable execution capability security rule enabled for the database in which you want to create shadow tables. See Enable execution capability

Without the Enable execution capability security rule, DMS can compare schemas but cannot execute SQL statements to apply the changes.

Create shadow tables

  1. Log on to the DMS console V5.0.

  2. In the top navigation bar, choose Database Development > Schema Change > Shadow Table Synchronization.

    In simple mode, hover over the icon in the upper-left corner and choose All Features > Database Development > Schema Change > Shadow Table Synchronization.

  3. On the Table Sync Tickets page, configure the following parameters:

    ParameterDescription
    Source DatabaseThe database in which to create shadow tables. Your account must have query and change permissions on this database. See View owned permissions.
    Prefix / SuffixThe prefix or suffix appended to each source table name to form the shadow table name. Format: <Prefix> + source table name, or source table name + <Suffix>. Default: __test_ prefix, producing names like __test_<source_table_name>.
    Synchronized TableThe scope of tables to synchronize. Partial Tables: synchronize only the tables you select. All Tables: synchronize all tables in the database.
    Synchronization PolicyWhen to run the synchronization. Synchronize Now: runs once immediately after you submit the ticket. Scheduled Synchronization: runs on a recurring schedule you define using a crontab expression. The minimum interval is 1 hour. The default schedule runs daily at 02:00.
    Whether to Ignore ErrorHow DMS handles SQL execution errors. Not Ignore: stops execution when an error occurs. Ignore: skips the failed statement and continues executing remaining statements.
  4. Click Submit. DMS begins schema analysis, comparing the source table schemas to determine which SQL statements are needed. If schemas change during this step, click Re-analyze in the Schema Analysis step to refresh the analysis.

  5. Click Submit for Approval and wait for the ticket to be approved. This step sends the ticket through your organization's approval workflow. DMS does not execute any SQL statements until the ticket is approved and you proceed to the next step.

  6. Click Submit and Synchronize to Target Database.

  7. Review the SQL statements to be executed, then click Confirm Synchronization. DMS executes the SQL statements to synchronize schemas. Click Details to view operation logs, including the SQL statements, execution duration, and scheduling details.

Crontab expressions

Use a crontab expression to schedule recurring synchronization. An expression is a space-separated string of six fields:

Second  Minute  Hour  Day  Month  Week

Field reference

FieldValid valuesSpecial characters
Second0–59- * /
Minute0–59- * /
Hour0–23- * /
Day1–31- * ? / L W C
Month1–12 or JAN–DEC- * /
Week1–7 or SUN–SAT (1 = Sunday, 2 = Monday, ..., 7 = Saturday)- * ? / L C #

Specify a value for either Day or Week, not both. Set the unused field to ?.

Special characters

CharacterDescriptionExample
*All values* in Minutes runs every minute
?Any value (Day and Week only)Placeholder for whichever of Day or Week you are not specifying
-Range5-20 in Minutes runs each minute from minute 5 to minute 20
/Start and interval5/20 in Minutes runs at minute 5, 25, and 45
,List5,20 in Minutes runs at minute 5 and minute 20
LLast day or weekday (Day and Week only)5L in Week runs on the last Thursday of the month
WNearest weekday Mon–Fri (Day only)5W runs on the nearest weekday to the 5th of the month
LWLast weekday of the month
#Nth weekday in the month (Week only)4#2 runs on the Wednesday of the second week (4 = Wednesday, 2 = second week)

Examples

ExpressionSchedule
0 0 23 ? * 7,123:00 every Saturday (7) and Sunday (1)
0 30 9 5,15,25 * ?09:30 on the 5th, 15th, and 25th of each month
0 0 0 */2 * ?00:00 every two days
13 13 15 20 * ?15:13:13 on the 20th of each month