All Products
Search
Document Center

Data Management:Manage schema versions

Last Updated:Jul 09, 2024

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.

Prerequisites

You have the query permissions on the table or the database to which the table belongs. For more information, see View owned permissions.

Overview

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:

Note
  • If the schema of a table in a database is changed in an environment other than DMS, you can synchronize the metadata of the database in DMS to obtain and save the latest schema. For more information, see Synchronize the data dictionary of a database instance.

  • If the database instance in which the database resides is managed in Security Collaboration mode, you can also click the 同步元数据按钮 icon on the SQLConsole tab to synchronize the metadata of the database.

Usage notes

  • The following database engines are supported:

    • 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

  • 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: unlimited

  • 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

Procedure

  1. Log on to the DMS console V5.0.
  2. You can go to the Database version list page by 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 SQLConsole tab of the database that you want to manage, click the image.png icon. The Database version list page appears.

    • On the Database List tab of the Instances page, find the database that you want to manage, move the pointer over More in the Actions column, and then select Version Management. This method is applicable only to DMS administrators or database administrators (DBAs).

  3. 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.

    Operation

    Description

    View change details

    View the SQL script that is used to generate the schema version.

    Roll back data

    Roll back data to 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.