After you change the schema of a table in a database in Data Management (DMS), DMS adds the latest schema to the schema version list of the database. You can download and compare schema versions and restore an earlier schema version in the schema version list.
You have permissions to query the data of the table or the database to which the table belongs. For more information, see View owned permissions.
Schema versions are defined based on a database and store the schema information of all the tables in the database. If the schema of a table in the database is changed, a new schema version is saved. New schema versions are saved when the following operations are performed in DMS:
SQL statements are executed on the SQL Console tab to change schemas.
SQL statements are executed to change schemas when you submit tickets for normal data modify, lock-free data change, schema design, or schema synchronization.
SQL statements are executed to change schemas by a DMS administrator.
If the schema of a table in a database is changed in environments other than DMS, you can perform the following operations in DMS to synchronize the latest schema of the database:
If the instance in which the database resides is managed in Security Collaboration mode, click the icon in the upper-right corner of the SQL Console page to synchronize the latest schema.
If the instance in which the database resides is managed in Flexible Management or Stable Change mode, click the icon in the upper-left corner of the SQL Console page to synchronize the latest schema.
The following database engines are supported:
MySQL series: native MySQL, Apsara RDS for MySQL, PolarDB for MySQL, PolarDB for Xscale, AnalyticDB for MySQL, and ApsaraDB OceanBase for MySQL
PostgreSQL series: native PostgreSQL, PolarDB for PostgreSQL, and AnalyticDB for PostgreSQL
PolarDB for PostgreSQL(Compatible with Oracle)
SQL Server series
The following content shows the maximum number of schema versions that can be retained for each database in database instances that are managed in different control modes:
Flexible Management: 3
Stable Change: 20
Security Collaboration: 50
You cannot manage schema versions for the following databases:
Databases that contain more than 1,024 tables
System databases such as the information_schema and sys databases in a MySQL database instance
- Log on to the DMS console V5.0.
You can go to the Database version list tabby using one of the following methods:
In the left-side navigation pane of the DMS console, click the database instance in which the database that you want to manage resides, right-click the database, and then select Version management.
On the SQL Console page of the database that you want to manage, move the pointer over the icon and select.
On the Database List tab of the Instances page, find the database that you want to manage and choosein the Actions column. This method can be used only if you are a database administrator (DBA) or DMS administrator.
On the Database version list page, find the version number of the schema that you want to manage. The following table describes the operations that you can perform.
View the detailed information about the schema version.
Preview the SQL script that is used to generate the schema version.
Table structure comparison
Synchronize the schema version to another database, or compare the schema version with a schema version in another database. For more information, see Synchronize schemas.
Synchronize the schema version that you want to restore to an empty database. For more information, see Initialize empty databases.