Data Transmission Service (DTS) provides the object name mapping feature. You can use this feature to map the names of objects in the source instance to those in the destination instance. This topic describes how to use the object name mapping feature when you configure a DTS task.

Scenarios

In the Configure Objects and Advanced Settings step, you can set the object names that you want to use in the destination database. For example, to synchronize or migrate data from Table A in the source database to Table B in the destination database, you can rename Table B as Table A. You can also use the object name mapping feature if you need to merge multiple tables into a large table.

Prerequisites

The task is not configured. The current step is Configure Objects and Advanced Settings. For more information about how to create and configure a DTS task, see Configure a data synchronization task.

Note We recommend that you do not use the object name mapping feature after a DTS task is started. Otherwise, the task may fail.

Map the name of a single object

  1. In the Configure Objects and Advanced Settings step, move a database or table to the Selected Objects section and then right-click the database or table.
  2. In the dialog box that appears, set the object name that you want to use in the destination instance.
    Note
    • If the source and destination databases are self-managed MySQL databases, ApsaraDB RDS for MySQL, or PolarDB for MySQL, you can select the DDL and DML statements that you want to synchronize or migrate.
    • If you select different statements for database name mapping and table name mapping, the statements that are selected for table name mapping prevail.
    • Database name mapping

      In the Edit Database Name dialog box, set the database name that you want to use in the destination instance.

      Set a database name
    • Table name mapping

      In the Edit Table Name dialog box, set the table name that you want to use in the destination instance.

      Set a table name
    • Column name mapping

      In the Edit Table Name dialog box, set the column names that you want to use in the destination instance.

      Set column names
      Note In this step, you can clear the columns that do not need to be synchronized or migrated.
  3. Click OK.
  4. Configure other parameters that are required for the DTS task.

Map multiple object names at a time

  1. In the Configure Objects and Advanced Settings step, move the required objects to the Selected Objects section.
  2. Click Batch Edit.
    Batch Edit
  3. In the Batch Edit dialog box, map the names of databases, tables, and columns based on your needs.
    1. Select the type of batch edit. In this example, select Select All Databases and Tables.
    2. Select the scope of batch edit.
      • Edit Renamed Object Name: edits the names of databases, tables, and columns based on their renamed names.
      • Edit Original Name: edits the names of databases, tables, and columns based on their original names.
    3. Select the objects whose names you want to edit.
    4. Set the names of databases and tables by using one of the following three rules. Then, click Add Rule.
      • Add Prefix and Suffix: Enter a prefix and suffix next to the Add Prefix and Suffix field.
      • Change All Names: Select Change All Names from the Select Rule drop-down list and enter the new name.
      • Shorten All Names: Select Shorten All Names from the Select Rule drop-down list and enter the keyword that you want to remove from object names.
      Configure rules for object name mapping
      Note In the Batch Edit dialog box, you can specify conditions to filter data. For more information, see Use SQL conditions to filter data.
    5. Click OK.
  4. Configure other parameters that are required for the DTS task.