Data Management (DMS) allows you to configure logical databases and logical tables to facilitate data query and management in database shards and table partitions. You can configure a logical database or logical table for one or more physical databases. This way, you can query and manage the complex and massive database shards and table partitions in the physical databases with ease.

Background information

In database sharding and table partitioning, business data is distributed to numerous tables in various physical databases based on routing algorithms. However, this hinders data query and analysis. To find the required data, you may need to traverse all tables. In addition, great efforts are required for you to add a field to a table partition in a database shard.

To resolve this issue, DMS allows you to configure logical databases and logical tables. You can configure a logical database for one or more physical databases. Then, DMS parses all the tables in this logical database and automatically generates a logical table for all the tables that have the same schema and the same prefix in table names. After the configuration is complete, you can manage the logical table as a regular table.

Prerequisites

  • You are the owner of the physical databases for which you want to configure a logical database. For more information, see Manage permissions.
  • The physical databases are MySQL, SQL Server, or Oracle databases. For more information, see the supported database types for querying logical databases or tables in Supported database types and features.
  • The database instances to which the physical databases belong are managed in Security Collaboration mode. For more information, see Control modes.

Configure a logical database

  1. Log on to the DMS console V5.0.
    Note To switch to the previous version of the DMS console, click the 5租户头像 icon in the lower-right corner of the page. For more information, see Switch to the previous version of the DMS console.
  2. In the top navigation bar of the DMS console, enter the name of a physical database in the search box and click the Search icon icon.
  3. Find the physical database for which you want to configure a logical database, move the pointer over More in the Actions column, and then select Configure Logical Database.
  4. Configure the logical database.
    1. Optional:In the upper part of the Create Logical Database Configuration dialog box, enter the names of other physical databases in the search box to search for other databases. Fuzzy match is supported. Select the required physical databases from the matched results and add the databases to the Database/Schema section on the right.
      The physical databases to be added to the same logical database must meet the following requirements:
      • These physical databases are of the same type, such as MySQL.
      • These physical databases are deployed in the same environment, such as the development environment. For more information, see the "Supported environment types" section of the Change the environment type of an instance topic.
      • A physical database can belong only to one logical database. If the physical database belongs to an existing logical database, remove the physical database from the logical database and try again.

      By default, the physical database that is obtained after the search in the top navigation bar is listed at the top of the Database/Schema section. You can add other physical databases. Make sure that the physical databases are added in the same order as that for actually sharding the databases. This prevents the table partitions in the logical database from being affected in queries.

      Note This step is optional. You can also configure a logical database for a single physical database.
    2. In the Alias field, enter an alias for the logical database.
      By default, the name or part of the name of the first physical database in the Database/Schema section is used as the name of the logical database. You can specify an alias for easy identification.Alias
    3. Optional:If DMS returns Failed to provide recommendations because databases in the logical database belong to different owners., the physical databases added to the logical database have different owners and no owner can be recommended for the logical database.Data Owner If you are a DMS administrator or database administrator (DBA), you can click Change Data Owners to specify an owner for all the physical databases.
      If you are a DMS administrator or DBA, you can apply for the Data Owner permissions on the physical databases. For more information, see Manage permissions.
  5. Click Save Configuration.
    The The configuration is saved. message appears, which indicates that the logical database is configured. Then, you can enter the name to search for the logical database in the top navigation bar.

    Click Logical Database next to the name of the logical database to view the physical databases of the logical database.

Modify a logical database

  1. Log on to the DMS console V5.0.
    Note To switch to the previous version of the DMS console, click the 5租户头像 icon in the lower-right corner of the page. For more information, see Switch to the previous version of the DMS console.
  2. In the top navigation bar of the DMS console, enter the name of the logical database that you want to modify in the search box and click the Search icon icon.
    Note In the Advanced options section, you can select Logical Database from the All Objects drop-down list to filter logical databases.Object
  3. Find the logical database, move the pointer over More in the Actions column, and then select Edit Logical Database Configuration.
  4. In the dialog box that appears, modify the configuration of the logical database.
    Note For more information, see Step 4 in the "Configure a logical database" section of this topic.
  5. Click Save Configuration.

Delete a logical database

  1. Log on to the DMS console V5.0.
    Note To switch to the previous version of the DMS console, click the 5租户头像 icon in the lower-right corner of the page. For more information, see Switch to the previous version of the DMS console.
  2. In the top navigation bar of the DMS console, enter the name of the logical database that you want to delete in the search box and click the Search icon icon.
    Note In the Advanced options section, you can select Logical Database from the All Objects drop-down list to filter logical databases.Object
  3. Find the logical database, move the pointer over More in the Actions column, and then select Delete logical DB config.
  4. In the message that appears, click Confirm.

What to do next

Update a logical table