Instance and table restoration is a process of restoring a specified instance or table of a cluster. For example, if you are the database administrator of a games company, you can use the database and table restoration feature to restore the data of a player or a group of players. An instance or a table can be restored from a backup set or to a point in time. This topic describes how to restore the data of a database or table to a previous point in time.

Limits

One of the following PolarDB clusters must be used:
  • A cluster of PolarDB for MySQL 5.6 whose minor version of the kernel is 5.6.1.0.24 or later. For more information, see Version management.
  • A cluster of PolarDB for MySQL 5.7 whose minor version of the kernel is 5.7.1.0.8 or later.

Precautions

  • You can restore only specified tables, so you must confirm that you have selected all the tables that you want to restore.
    Note If you cannot determine which tables to restore, we recommend that you restore all the 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 full restoration: point-in-time restore.
  • If the specified tables are deleted during the time period 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 an instance, all tables in the instance 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 full restoration: point-in-time restore.
  • The instance and table restoration feature only applies to clusters that have no more than 50,000 tables.
  • The instance and table restoration feature does not restore triggers. If the original table has a trigger, the trigger will not be restored.
  • The instance and table restoration feature does not restores foreign keys. If the original table has a foreign key, the foreign key will not 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 that you want to manage is deployed.
  3. Find the cluster that you want to manage and click the cluster ID.
  4. In the left-side navigation pane, choose Settings and Management > Backup and Restore.
  5. On the Backup and Restore page, click Restore Databases/Tables.
  6. In the dialog box that appears, set Restore Type to Backup Timepoint and configure Restoration Time.
    2
    Note The point in time specified by Restore To must fall within the time range that is specified by Restoration Time. The full backup set that is most recent to the specified point in time must contain the table that you want to restore. This way, the Backup Timepoint restore type can be used. The time range specified by the Restore To parameter is determined by the value of Log Backups Retained For. The default value of the Log backup retention parameter is 7 days.
  7. In the Databases and Tables to Restore section, select a database to restore in the left and then select tables to restore in the right.
    1
    Note
    • If you select no tables after you select a database, all data in the database is restored.
    • After you select a database or a table, the system specifies the _backup suffix in the name of the original database or the original table to name the new database or the new table. For example, if the name of the original table is test, the new table is named test_backup. You can customize names for new databases and new tables.
  8. Click OK.

Related API operations

API operation Description
DescribeMetaList You can call the DescribeMetaList operation to query the metadata of the instance or table that you want to restore.
RestoreTable You can call the RestoreTable operation to restore the instances or tables of a PolarDB cluster.