Database and table restoration is a process of restoring only a specified database or table of a cluster. For example, if you are a games company, you can use the database and table restoration feature to restore the data of a player or a group of players. Database and table restoration supports two methods: restore from a backup set and restore data to a previous point in time. This topic describes how to restore a specified database or table from a backup set.

Limits

One of the following PolarDB clusters must be used:
  • A cluster of ApsaraDB PolarDB MySQL-compatible edition 5.6 whose minor version of the kernel is 5.6.1.0.24 or later. For more information, see Upgrade versions.
  • A cluster of ApsaraDB PolarDB MySQL-compatible edition 5.7 whose minor version of the kernel is 5.7.1.0.8 or later.

Precautions

  • Only the tables that you specify are restored. Therefore, you must confirm that you have selected all the tables that you want to restore.
    Note If you cannot determine tables to restore, we recommend that you restore all data of your cluster to a new cluster and then migrate the data back to the original cluster. For more information, see Method 1 for cluster restoration: Restore from a backup set and Method 2 for cluster restoration: Restore data to a previous point in time.
  • If the specified tables are deleted during the period of time between the generation of the last backup set and the specified time, you cannot restore the data by Backup Timepoint.
  • You can restore up to 100 tables at a time. If you choose to restore a database, all tables in the database can be restored.
    Note To restore a large number of tables, we recommend that you restore all data of your cluster to a new cluster. For more information, see Method 1 for cluster restoration: Restore from a backup set and Method 2 for cluster restoration: Restore data to a previous point in time.
  • The database and table restoration feature can be applied only to clusters that have 50,000 tables or less. Databases or tables cannot be restored for a cluster that has more than 50,000 tables.
  • The database and table restoration feature does not support the restoration of triggers. If the original table has a trigger, the trigger cannot be restored.
  • The database and table restoration feature does not support the restoration of foreign keys. If the original table has a foreign key, the foreign key cannot be restored.

Procedure

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster is deployed.
  3. Find the cluster and click the cluster ID.
  4. On the Backup and Restore page, click Restore Databases/Tables.
  5. In the dialog box that appears, select Backup Set in the Restore Type section and select the backup set from which you want to restore data in the backup set drop-down list.
    1
  6. On the Databases and Tables to Restore page, select the database that you want to restore in the left section, and select the table that you want to restore in the right section.
    1
    Note
    • If you select a database but do not specify tables, all data in the database is restored.
    • After you select a database or table, the system generates the name of the new database or table by adding the _backup suffix to the name of the original database or table. For example, if the name of a table is test, the new table is named test_backup. You can also customize the names of new databases and tables.
  7. Click OK.

References

API Description
DescribeMetaList Queries the metadata of the database or table that you want to restore.
RestoreTable Restores the databases or tables of a PolarDB cluster.