Schema synchronization compares the schemas of two databases, generates the DDL statements needed to close the gap, and executes those statements against the destination database — all without touching any row data.
Use schema synchronization to keep schemas consistent across environments: production-to-test, test-to-test, or production-to-production.
Prerequisites
Before you begin, make sure you have:
A source and destination database of a supported type
The Enable execution capability (if closed, other rules are invalid) security rule enabled for the destination database (see Enable execution capability)
Query permissions on the source database (see View owned permissions)
Permissions to alter tables in the destination database (see View owned permissions)
Without the Enable execution capability security rule, DMS can compare schemas but cannot execute the generated SQL statements.
Supported database types
| Engine | Supported products |
|---|---|
| MySQL | ApsaraDB RDS for MySQL, PolarDB for MySQL, ApsaraDB MyBase for MySQL, PolarDB-X, AnalyticDB for MySQL V3.0, MySQL databases from other sources |
| SQL Server | ApsaraDB RDS for SQL Server, ApsaraDB MyBase for SQL Server, SQL Server databases from other sources |
| PostgreSQL | ApsaraDB RDS for PostgreSQL, PolarDB for PostgreSQL, ApsaraDB MyBase for PostgreSQL, AnalyticDB for PostgreSQL, PostgreSQL databases from other sources |
| MariaDB | ApsaraDB RDS for MariaDB, MariaDB databases from other sources |
| OceanBase | ApsaraDB for OceanBase in MySQL mode |
| PolarDB | PolarDB for PostgreSQL (Compatible with Oracle) |
How schema synchronization works
Schema synchronization only changes structure — it never moves data between databases.
When DMS compares schemas, the outcome depends on whether matching table names exist in the destination:
| Situation | DMS behavior |
|---|---|
| Table exists in source but not in destination | Creates the table in the destination database |
| Table exists in both databases | Adds or removes fields to make the destination table match the source |
| Table exists in destination but not in source | No action — DMS never deletes a table from the destination |
Removing a field also permanently deletes all data in that field. Review the generated SQL statements carefully before confirming synchronization.
Synchronize schemas
The workflow has four stages: configure the ticket → analyze schemas → get approval → execute synchronization.
Before you start: Schedule schema synchronization during off-peak hours. Synchronization duration depends on the number of tables and the current task queue.
Log on to the DMS console V5.0.
In the top navigation bar, choose Database Development > Schema Change > Schema Synchronization.
NoteIn simple mode, hover over the
icon in the upper-left corner and choose All Features > Database Development > Schema Change > Schema Synchronization.On the Table Sync Tickets page, configure the following parameters:
WarningChoosing Ignore may cause DDL statements to be skipped, resulting in an incomplete or inconsistent synchronization. Review carefully before selecting this option.
Parameter Description Source database The source database for schema synchronization. Enter a keyword to search. (Optional) Specify a schema version number — the latest schema is used by default. See Manage schema versions. Destination database The destination database for schema synchronization. Enter a keyword to search. (Optional) Specify a schema version number — the latest schema is used by default. See Manage schema versions. Synchronized table The tables to synchronize. Select Partial Tables to specify source and destination table names (destination defaults to the same name as the source), or All Tables to synchronize all tables in the source database. Whether to ignore error How to handle errors during SQL execution. Not Ignore stops execution when an error occurs. Ignore skips the failed statement and continues with the rest. Click Submit. DMS starts schema analysis. If schemas change during analysis, click Re-analyze in the Schema Analysis step.
Click Submit for Approval and wait for the request to be approved.
After approval, click Submit and Synchronize to Target Database.
Review the SQL statements to be executed. Click Confirm Synchronization. After execution starts, click Details to view operation logs, including the SQL statements, execution duration, and scheduling details.
WarningCheck for any field deletions before proceeding — removing a field permanently deletes its data.
When the Synchronized. message appears, schemas are successfully synchronized to the destination database.
What's next
Manage schema versions — version and roll back schema changes
View owned permissions — verify or request the permissions required for schema synchronization