Data Transmission Service (DTS) supports object name mapping. This feature lets you rename objects in the destination instance. This topic describes how to use object name mapping when you configure a data migration task.
Limitations
- Object name mapping is available only in the Migration Types and Objects step when you configure a data migration task. Note Do not perform object name mapping after a data migration task starts. Otherwise, the migration task may fail.
- For MongoDB databases, only database name mapping and collection name mapping (equivalent to table name mapping) are supported.
Map individual object names
- In the Migration Types and Objects step, move the objects you want to migrate to the Selected box. Hover over the database or table name you want to modify and click the Edit button. Important The supported objects vary depending on the source database.
- In the dialog box, set the destination name for the object. Note
- If the source and destination databases are self-managed MySQL, ApsaraDB RDS for MySQL, or PolarDB for MySQL, you can also filter Data Definition Language (DDL) and Data Manipulation Language (DML) statements when mapping database or table names. You can select the specific DDL or DML statements to synchronize.
- If the statements selected for database name mapping and table name mapping conflict, the settings for table name mapping take precedence.
- Database name mapping
In the Edit Database Name dialog box, set the destination database name.
For example, you can change the database name fromdtstestdatatodtstestdatanew. In the DML&DDL Filtering section, select the DML operations (such as insert, update, and delete) and DDL operations (such as CREATE, ALTER, and DROP for tables, views, procedures, triggers, functions, and indexes) to synchronize. Then, click OK. - Table name mapping
In the Edit Table dialog box, set the destination table name.
In the Database Table Name field, enter the destination table name (for example, renaming the original tabletest1totestnew). You can also set a filter condition, which supports standard SQL WHERE clauses. Click Validate Syntax to check your query. In the DML&DDL Filtering section, select the DML (insert, update, delete) and DDL (CREATE, ALTER, DROP for tables, views, procedures, triggers and functions, and indexes) operation types to synchronize. - Column name mapping
In the Edit Table dialog box, set the destination column names.
For example, you can rename the columnareatoareanew. When you modify a column name, a red tooltip appears above the input box to show the original column name.Note In this step, you can also filter out columns that you do not want to migrate by clearing their corresponding checkboxes.
- Click OK.
- Follow the prompts to complete the task configuration.
Map multiple object names in batch
- In the Migration Types and Objects step, move the objects you want to migrate to the Selected box. Important If the last object selected is a database, the batch name mapping feature is not available, and the Batch Change Object Names option is disabled.
- Click Batch Change Object Names at the bottom of the page, and then click Advanced Settings.
- On the Advanced Settings page, configure batch mapping rules for table and column names.
- Select a scope for the rules. This example uses Partial Selection. Important When you select Partial Selection, you can enter keywords for database or table names to filter the objects targeted by the rules.
- Select and configure a rule.
- Click Add Rule. Important You can repeat these steps to configure different rules for different tables.
- Click Preview to verify that the rules work as expected. On the advanced settings page, you can filter for tables by using the Source Table Keyword field, select a rule type such as Rename All or a rule to add a prefix or suffix, and then enter a value in the Name field. For example, assume that Rule 1 adds the prefix
test_to thecustomertable, and Rule 2 renames theordertable toneworder. After you click Preview, the partial preview table shows that thecustomerandordertables in thedtstestdatasource database are mapped totest_customerandneworderin the destination database, respectively. - On the Partial Preview tab, click the
icon next to a database name in the Destination Database section, and then click Modify Column Names and Filter Conditions. - Configure the column name mapping rules and click OK. For example, you can select Add Prefix/Suffix, enter
test_in the prefix input box, and then click OK in that row to generate the mapping rule. After the rule is applied, the target column names in the table below are automatically updated with the prefix (for example,addressbecomestest_address).Important- By default, a rule applies to all columns. You can enter a column name keyword and click Search to filter the columns to map.
- In this dialog box, you can also configure a filter condition to filter the data to be migrated. For more information about the syntax, see Filter Condition Configuration.
- Click OK.
- Select a scope for the rules. This example uses Partial Selection.
- After completing the configuration, click Precheck and Start.
- Follow the prompts to complete the task configuration.
该文章对您有帮助吗?