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 by using the new DTS console.
Map the name of a single object
- 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.
- 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.
- Table name mapping
In the Edit Table Name dialog box, set the table name that you want to use in the destination instance.
- Column name mapping
In the Edit Table Name dialog box, set the column names that you want to use in the destination instance.
Note In this step, you can clear the columns that do not need to be synchronized or migrated.
- Click OK.
- Configure other parameters that are required for the DTS task.
Map multiple object names at a time
- In the Configure Objects and Advanced Settings step, move the required objects to the Selected Objects section.
- Click Batch Edit.
- In the Batch Edit dialog box, map the names of databases, tables, and columns based on your needs.
- Select the type of batch edit. In this example, select Select All Databases and Tables.
- 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.
- Select the objects whose names you want to edit.
- 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.
Note In the Batch Edit dialog box, you can specify conditions to filter data. For more information, see Use SQL conditions to filter data. - Click OK.
- Configure other parameters that are required for the DTS task.