DBS (DBS) allows you to restore data by database or table. If data is deleted from a specific database or table by mistake, you can restore the database or table without the need to restore the entire database instance. This shortens the recovery time objective (RTO).

Overview

During a logical backup, DBS stores backup data in the dimensions of database objects such as tables or databases. When you restore data by database or table, DBS reads data only from the specified one or more tables for restoration. This shortens the RTO. If the incremental backup feature is enabled, DBS allows you to restore the data to a point in time from the completion of the first full backup to the completion of the last incremental backup.
Note DBS supports incremental backups only for some types of databases. For more information, see Database engines and features.

Prerequisites

At least one logical backup is complete. DBS does not allow you to restore data by database or table from a physical backup. For more information, see Configure a backup schedule.
Note To perform a logical backup on a PolarDB-X database, you must back up the entire database instance. As a result, DBS does not allow you to restore PolarDB-X data by database or table.

Procedure

  1. Log on to the DBS console.
  2. In the left-side navigation pane, click Backup Schedules. On the Backup Schedules page, select a region in the upper-left corner.
  3. On the Backup Schedules page, find the ID of the backup schedule that you want to use to create a restore task, and click Manage in the Actions column.
  4. On the Configure Task page, click Restore Database in the upper-right corner.
  5. In the Set Time Restored To step, set the parameters in the Set Time Restored To and Configure Destination Database sections and click Next.
    Note
    • If the incremental backup feature is enabled, DBS allows you to restore the data to a point in time from the completion of the first full backup to the completion of the last incremental backup.
    • If the incremental backup feature is disabled, DBS allows you to restore the data to a point in time when a full backup is complete.
    For more information about the parameters, see the topics about how to restore databases.
    Restore a MySQL database
  6. In the Configure Objects to Restore step, set the Conflict Handling parameter and specify the databases or tables to be restored in the Objects to Restore section.
    Restore one or more tables
    ParameterDescription
    Conflict HandlingSelect one of the following methods for conflict handling:
    • Fail when Object with the Same Name Exists.
    • Rename Object with the Same Name: If you select this option, DBS renames the new table that is to be created by the restore task. For example, a table to be restored in the source database and an existing table in the destination database have the same name job_info. The system renames the new table that is restored from the table in the source database in the following format: job_info_dbs_<ID of the restore task>_</Timestamp>.
    Objects to RestoreThe database or table that you want to restore. Select the database or table that you want to restore in the Available section and click the right arrow to add it to the Selected section. In this example, only the persons and sbtest100 tables are selected for restoration.
  7. In the lower-right corner of the page, click Precheck.
    DBS checks the preceding configurations, database connectivity, and database permissions.
  8. After the Precheck Passed message appears in the Precheck dialog box, click Start Task.

    To view the database restoration progress, click Restore Tasks in the left-side navigation pane.

    Note The amount of time used to restore a database depends on the specifications of the backup schedule and the size of the database. For more information, see Performance tests on backup and restoration.

    If you restore a database to a new ApsaraDB RDS instance, it takes about 5 to 10 minutes for the instance to be created. After the database is restored, you can view the new ApsaraDB RDS instance in the ApsaraDB RDS console. Alternatively, perform the following steps to view the new ApsaraDB RDS instance: On the Restore Tasks page, click the ID of the restore task. On the page that appears, click the ID of the ApsaraDB RDS instance in the Basic Information section. You are navigated to the ApsaraDB RDS console.