If you want to restore the data of a database or table to a previous point in time and the point in time is when a backup set (snapshot) was created, you can restore the data from the backup set (snapshot) that was deleted or modified accidentally.

Prerequisites

  • Your instance has a backup set (snapshot) before the data was deleted or modified accidentally.
  • Your PolarDB cluster must be one of the following versions:
    • A PolarDB for MySQL 5.6 cluster whose kernel minor version is 5.6.1.0.24 or later
    • A PolarDB for MySQL 5.7 cluster whose kernel minor version is 5.7.1.0.8 or later

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 by using a cluster restoration method.
  • 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. 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 If you need to restore a large number of tables, we recommend that you restore all the historical data of the entire cluster by using a cluster restoration method.
  • The instance and table restoration feature does not support the restoration of triggers. If the original table has a trigger, the trigger will not be restored.
  • The instance and table restoration feature does not support the restoration of foreign keys. If the original table has a foreign key, the foreign key will not be restored.

Step 1: Start restoration

  1. In the left-side navigation pane on the Overview page, choose Settings and Management > Backup and Restore.
  2. On the Backup and Restore page, click Restore Databases/Tables.
  3. 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
  4. 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 automatically 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, then the new table is named test_backup. You can also customize the names of new databases and tables.
  5. Click OK.

Step 2: Compare data

After all the data has been restored, you need to log on to your cluster and compare and verify the data.

You can log on to the new cluster by using DMS, other clients, or Alibaba Cloud command line interface (CLI). This topic describes how to log on to your cluster and verify data on the DMS console. For more information about other methods, see Connect to a cluster.

  1. In the upper-right corner of the Overview page, click Log On to Database.
    Overview
  2. In the dialog box that appears, specify database account and database password that are created in your cluster, and click Login.Logon page
  3. After you log on to DMS, refresh the page. In the left-side navigation pane, click Logged in instance.
  4. In the Logged in instance list, click the cluster and double-click the database that you want to manage.
    1
  5. Locate the data that was deleted or modified accidentally and confirm whether it has been restored, and check whether other data is consistent with what it was before the accidental deletion or modification occurred.