All Products
Search
Document Center

ApsaraDB for OceanBase:Rename a database table

Last Updated:Mar 27, 2023

This topic describes how to use the migration object renaming feature provided by the data transmission service.

Scenarios

By default, migration objects, such as databases and tables, have the same names in the source and destination. You can rename migration objects in the destination to map the database and table names between the source and the destination. The renaming feature applies to multi-table aggregation scenarios and scenarios where the object names in the test and production environments are inconsistent.

Note

The multi-table aggregation feature is mainly used to synchronize data from DRDS and MyCat data sources to the same table in the destination database.

Limits

  • Data transmission only allows you to rename objects in the step of selecting migration objects when you configure a data migration project.

  • Do not rename objects after the data migration project is started. Otherwise, the data migration project may fail.

Rename a specified object

  1. Create a data migration project and configure it to the Select Migration Objects step.

    For more information, see the topic about creating a data migration project between the corresponding data sources in the Data migration chapter.

  2. After you choose Specify Objects and specify the database objects to be migrated, move the pointer over the table object that you want to rename in the Destination Object list on the right of the Specify Migration Scope section.

  3. Click Rename.

    image
  4. Enter a new name for the object in the destination database.

    image
  5. Click OK.

    image
  6. Complete subsequent project settings as prompted.

Rename a match rule

  1. Create a data migration project and configure it to the Select Migration Objects step.

    For more information, see the topic about creating a data migration project between the corresponding data sources in the Data migration chapter.

  2. After you choose Match Rules and specify the database objects to be migrated, you can use the following two methods to rename a database table.

    Important
    • After you rename the destination object by using the object migration rules on the left, you cannot rename this object again on the right.

    • The row filter conditions and other settings remain the same after a match rule is renamed.

    • <Source database>.* = <Destination database>.<Table name> specifies to map all tables in the source database to the specified table in the destination database. In other words, if we represent that string as a.b=c.d, we can use wildcards only for b, while a, c, and d are specific names of databases and tables.

    • On the left side of the Specify Migration Scope section, rename objects by configuring the object migration rules.

      In the Object Migration Rule section, clear the mappings between the source and destination objects by using an equal sign (=), and then rename the objects. For example, if the source database name is e and the table name is f, you can enter e.f=m.n to change the source database name to m and the table name to n.

      1. In the Specify Migration Scope section, enter the new name of the object migration rule.

      2. Click Verify.

      3. In the dialog box that appears, click OK.

      4. After the verification succeeds, click Preview Object to view the new database name and table name.

        image
    • On the right side of the Specify Migration Scope section, rename the matching objects.

      1. In the Specify Migration Scope section, specify object migration rules in the Object Migration Rule field and object exclusion rules in the Object Exclusion Rule field. The Object Exclusion Rule field is optional.

      2. Click Verify. After the verification succeeds, click Preview Object.

      3. On the right side of the Matching Result page, move the pointer over the target database or table object, and click Rename.

        image
      4. Enter a new name for the object in the destination database.

      5. Click OK.

  3. Complete subsequent project settings as prompted.