All Products
Search
Document Center

Database Backup:Restore data by database or table

Last Updated:Mar 25, 2024

Database Backup (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 helps you correct the mistake in an efficient manner and analyze historical data.

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 database or table for restoration. This shortens the recovery time objective (RTO).

If you enable the incremental log backup feature for your DBS backup schedule, you can 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 you disable the incremental log backup feature, you can restore the data only to the point in time when the full backup is complete. For more information about how to check whether the incremental log backup feature is enabled, see View a backup schedule. For more information about how to enable or disable the incremental log backup feature, see Enable or disable incremental log 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.

Note
  • This feature supports only logical backups. DBS does not allow you to restore data by database or table from a physical backup. For more information, see Logical backup, physical backup, and snapshot and Logical backup.

  • 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 Database Backup (DBS) console.

  2. In the left-side navigation pane, click Backup Schedules. In the top navigation bar, select a region.

  3. On the Backup Schedules page, find the backup schedule that you want to use 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, configure the parameters and click Next.

    Note

    For more information about the parameters, see Backup and restoration overview.

    image

  6. In the Configure Objects to Restore step, configure the parameters that are described in the following table and click Precheck.

    image

    Parameter

    Description

    Conflict Handling

    By default, Rename Object with the Same Name is selected. For example, a table with the same name exists when the job_info table is restored. The restored table is renamed in the following format: job_info_dbs_<Restore task ID>_<Timestamp>.

    Objects to Restore

    Select the database or table that you want to restore in the Available section and click the rightwards arrow to add it to the Selected section. In this example, only the persons and sbtest100 tables are selected for restoration.

  7. 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.

    image

    Note
    • The restoration duration depends on the specifications of the backup schedule and the size of the database to be restored. The restoration duration is shorter for a backup schedule with higher specifications. For more information, see Performance tests on backup and restoration.

    • If you restore a database to a new ApsaraDB RDS instance, DBS needs about 5 to 10 minutes to create the instance. After the database is restored, you can view the new ApsaraDB RDS instance in the ApsaraDB RDS console. Alternatively, perform the following operations 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.

Related operations

  • You can also restore data by calling API operations. For more information, see CreateRestoreTask, StartRestoreTask, and DescribeRestoreTaskList.

  • You can modify the backup source and backup objects of a backup schedule. You can also modify the backup strategies of a backup schedule such as the backup time and retention period of the backup set. For more information, see Manage a backup plan.