DMS tracks schema changes at the database level. Each time a table's schema is modified through DMS, a new schema version is saved for the entire database. From the Database version list page, you can download and compare schema versions, or roll back to an earlier version to recover from an unwanted change.
How it works
A schema version captures the schema of all tables in a database at a point in time. DMS saves a new version whenever any of the following operations changes a table's schema:
-
SQL statements run on the SQLConsole tab
-
SQL statements submitted via tickets for normal data modify, lock-free data change, schema design, or schema synchronization
-
SQL statements run in SQL tasks by a DMS administrator
Prerequisites
Before you begin, ensure that you have:
-
Query permissions on the target table or database
-
A database of one of the following types:
-
MySQL: ApsaraDB RDS for MySQL, PolarDB for MySQL, PolarDB-X, AnalyticDB for MySQL, and OceanBase databases in MySQL mode
-
PostgreSQL: ApsaraDB RDS for PostgreSQL, PolarDB for PostgreSQL, and AnalyticDB for PostgreSQL
-
PolarDB for PostgreSQL (Compatible with Oracle)
-
SQL Server
-
MariaDB
-
Oracle
-
Limitations
| Constraint | Detail |
|---|---|
| Version retention by control mode | Flexible Management: 3 versions; Stable Change: 20 versions; Security Collaboration: unlimited |
| Databases with more than 1,024 tables | Schema version management is not supported |
| System databases | Not supported — for example, information_schema and sys in MySQL |
Open the Database version list page
Log on to the DMS console V5.0, then use one of the following methods to open the Database version list page.
From the Database Instances section
In the left-side navigation pane, click Database Instances. Find and right-click the target database, then select Version Management.
From the SQLConsole tab
Open the SQLConsole tab for the target database. Click the
icon in the upper-right corner.
From the Instances page (DMS administrators and DBAs only)
-
Hover over the
icon in the upper-left corner and choose All Features > Data Assets > Instances.Note If the console is in normal mode, choose Data Assets > Instances from the top navigation bar instead. -
On the Database List tab, find the target database.
-
In the Actions column, choose More > Version Management.

View, compare, and roll back schema versions
On the Database version list page, locate the schema version you want to work with. The following operations are available:
View the SQL behind a version
Click Change Details to see the exact SQL statements that generated the schema version. Use this to understand what changed between versions.
Compare two versions
Select two schema versions and click Version Comparison.
Roll back to the previous version
Click Rollback to roll back data to the previous schema version.