This topic describes how to restore specific databases or tables of a PolarDB for MySQL cluster to an original cluster.

Restoration methods

You can select different methods to restore the data in a PolarDB for MySQL cluster to a new or original cluster based on your business requirements.

  • Method 1: Restore all historical data to a new cluster.

    Restore all data of an original cluster to a new cluster, verify the data on the new cluster, and then migrate the data from the new cluster back to the original cluster. For more information, see Restore data.

    Note The new cluster to which data is restored contains the data and account information of the original cluster but does not contain the parameter settings of the original cluster.
  • Method 2: Restore data of specific databases or tables to the original cluster.

    For example, in gaming business, you must restore the data of one or more players. This topic describes how to restore data by using this method.

Prerequisites

The version of the PolarDB for MySQL cluster is 5.6 and the minor kernel version is 5.6.1.0.24 or later. For more information about how to upgrade minor versions, see Upgrade versions.

Precautions

  • You can restore only the specified tables. You must confirm that you have selected all of the tables that you want to restore.
    Note If you cannot determine all the related tables that you want to restore, we recommend that you restore all the historical data of the entire cluster to a new cluster and then migrate the data back to the original cluster. For more information, see Restore data.
  • 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 using 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 historical data to a new cluster. For more information, see Restore data.
  • Only clusters that have no more than 50,000 tables support restoring databases or tables. You cannot restore databases or tables of a cluster if the cluster has more than 50,000 tables.
  • When you restore databases and tables, take note that triggers 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 resides.
  3. Find the cluster, and then 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, select Restore Type or Backup Set as Restore Type based on your business requirements.
    • If you select Backup Set to restore a backup set, select the destination backup set from the backup set list.1
    • If you want to restore the data by Backup Timepoint, set the Restoration Time parameter.2
      Note The selected time selected as Restoration Time must follow the limits on Restore To. Only the data generated within the last seven days can be restored.
  7. On the left section of the Databases and Tables to Restore page, select the destination database and select the destination table on the right side.
    1
    Note
    • If you select a destination database but do not specify tables, all data in the database is restored.
    • After you select a destination database or table, the system automatically adds the _backup suffix to the new database or table. For example, the name test changes to test_backup. You can also use a custom name for the new database or table.
  8. Click OK.

FAQ

  • Q: Why does the restoration feature temporarily become unavailable?

    A: Check whether the cluster has an excessive number of tables. Only clusters that have no more than 50,000 tables support restoring databases or tables. You cannot restore databases or tables of a cluster if the cluster has more than 50,000 tables.

  • Q: Can I customize the name of the new database or table?

    A: Yes. Custom names for the new database or table are supported.

Related API operations

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