Data Management (DMS) introduces a new feature to change schemas without locking tables. This feature prevents your business from being blocked by table locks due to schema changes. This feature also minimizes the latency that is caused by the online DDL feature of MySQL during primary-secondary replication. This feature creates one or more temporary tables that use the new schema, replicates full data and incremental binary logs to the temporary tables, and then stores the temporary tables as permanent tables.


This feature is enabled for an ApsaraDB RDS for MySQL instance. For more information, see Enable the Open (DMS OnlineDDL first) feature.
Note In the following example, you must enable this feature for the ApsaraDB RDS for MySQL instance that simulates the development environment in advance.


In the following example, the feature changes the data type of the long_text_a column in the big_table table from varchar(1024) to text(1024).

  1. Submit a ticket as a regular user.
    1. Log on to the DMS console as a regular user.
    2. In the top navigation bar, click the More icon and choose Data Plans > Change > Normal Data Modify.
    3. Set the parameters as required and click Submit. The following table describes the parameters. Submit a ticket to change data without locking the table
      Parameter Description
      Database Required. The database in which you want to change data. In this example, select the poc_dev database.
      Reason Category Required. The reason for the data change. This helps you find the ticket in subsequent operations.
      Business Background Required. The purpose or objective of the data change. This reduces unnecessary communication.
      Execution Method Required. The method to be used to execute the data change. Select Last Auditor Execute.
      Affected Rows Required. The estimated number of data rows to be affected by this data change. To obtain the actual number of affected rows, you can include the COUNT function in SQL statements and execute the SQL statements on the SQLConsole tab.
      SQL Statements for Change Required. The SQL statement that you want to execute to change data. Enter the following ALTER statement:
      ALTER TABLE `big_table`
        MODIFY COLUMN `long_text_a` text(1024) NULL AFTER `name`;
      Note This statement changes the data type of the long_text_a column from varchar(1024) to text(1024).
      SQL Statements for Rollback Optional. The SQL statement that you can execute to roll back the data change.
      Change Stakeholder Optional. The stakeholders of the data change. All specified stakeholders can view the ticket details and assist in the approval process. Irrelevant users other than DMS administrators and database administrators (DBAs) are not allowed to view the ticket details.
    4. On the ticket details tab, confirm the ticket details.
      Note You can view the ticket details on the ticket details tab. DMS prechecks the SQL statement that you want to execute. The precheck items include the syntax of the SQL statement, the type of the SQL statement and whether the type matches the type that you configured in the security rules for the ApsaraDB RDS for MySQL instance, the permissions of the user that submitted the ticket, and the estimated number of rows to scan.
    5. After the ticket details are confirmed and the precheck is complete, click Submit for Approval. In the message that appears, click OK. Submit for Approval
      Note You can change the ticket details only before you submit the ticket for approval.
  2. Approve and handle the ticket as a DMS administrator.
    1. Log on to the DMS console as a DMS administrator.
    2. On the Workbench tab of the DMS console, click Pending Tickets in the My Tickets section. Pending Tickets
    3. On the My Tickets tab, find the ticket that you want to handle and click the ticket number in the Ticket Number column.
    4. On the ticket details tab, confirm the data change information in the ticket and click Approve.
    5. In the dialog box that appears, enter comments and click Submit. Confirm and approve the data change ticket
    6. In the Execute step, click Execute Change. In the dialog box that appears, set the parameters as required and click Confirm Execution. Set the parameters in the Task Settings dialog box
      Parameter Description
      Execute Immediately Specifies whether to run the task immediately or at a scheduled time. Valid values:
      • Running immediately: DMS immediately runs the task after you submit the task.
      • Schedule: DMS runs the task at the specified point in time.
      Default value: Running immediately.
      Transaction Control Specifies whether to enable transaction control. Valid values:
      • on: If an SQL statement fails to be executed, all the executed data manipulation language (DML) statements in the same transaction are rolled back. Data definition language (DDL) statements cannot be rolled back.
      • off: The SQL statements are executed one by one. If an SQL statement fails to be executed, the task stops running. The executed statements are not rolled back.
      Default value: off.
      Data Backup Specifies whether to back up data. Valid values:
      • on: DMS generates INSERT scripts to back up the data that will be affected when UPDATE or DELETE statements are executed.
      • off: No backup scripts are generated for the preceding data.
      Default value: on.
      Note After you click Confirm Execution, DMS starts to run the task.

View the task progress and verify the schema as a DMS administrator

  1. Log on to the DMS console as a DMS administrator.
  2. In the left-side navigation pane, click the POC_dev instance and double-click the poc_dev database to go to the SQLConsole tab.
    Go to the SQLConsole tab of the poc_dev database
  3. On the SQLConsole tab, enter the following SQL statement and click Execute to view the tables in the database:
    Query temporary tables
    Note When DMS changes the schema of a table without locking tables, two temporary tables are generated.
  4. In the top navigation bar, click the More icon and choose System > Task.
  5. On the Task tab, click the task number of the task that you want to view. The Execution details dialog box appears.
  6. Click Progress in the Operation column.
  7. In the Lock-Free structure change dialog box, view the task progress.
  8. After the task is complete, verify the schema.
    The schema of the big_table table is changed, and the temporary tables are deleted.