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 the 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. For more information, see Save new schema versions.
If a database instance that has five databases is managed in Security Collaboration mode, each database can contain 50 schema versions. In other words, for a database instance that is managed in Security Collaboration mode, a maximum of 50 schema versions can be retained for each database in the instance.
- The following database engines are supported:
- MySQL series: native MySQL, ApsaraDB RDS for MySQL, PolarDB for MySQL, PolarDB-X, AnalyticDB for MySQL, and ApsaraDB OceanBase for MySQL
- PostgreSQL series: native PostgreSQL, PolarDB for PostgreSQL, and AnalyticDB for PostgreSQL
- SQL Server
- 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 system databases in a MySQL database instance
Manage schema versions
- Log on to the DMS console.
- In the left-side navigation pane of the DMS console, click the database instance where the database that you want to manage resides,
right-click the database, and then select Version management. The Database version list tab appears.Note You can also go to the Database version list tab by using the following methods:
- On the SQLConsole tab of the database that you want to manage, move the pointer over the icon and select .
- On the Database List tab of the tab, find the database that you want to manage, move the pointer over in the Actions column, and then select Version management. You can use this method to go to the Database version list tab only as a DMS administrator or database administrator (DBA).
- On the Database version list tab, find the version number of the schema that you want to manage. You can perform
the operations that are described in the following table.
Action Description View View the detailed information of the schema version. Preview script 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. Structural recovery Synchronize the schema version that you want to restore to an empty database. For more information, see Initialize empty databases.
Save new schema versions
- If the instance where the database resides is managed in Security Collaboration mode, click the icon in the upper-right corner of the SQLConsole tab to synchronize the latest schema.
- If the instance where the database resides is managed in Flexible Management or Stable Change mode, click the icon in the upper-left corner of the SQLConsole tab to synchronize the latest schema.