All Products
Search
Document Center

Database Backup:Restore a MySQL database from a logical backup

Last Updated:Nov 16, 2023

This topic describes how to use Database Backup (DBS) to restore a MySQL database from a logical backup.

Prerequisites

A MySQL database is backed up. For more information, see Back up an ApsaraDB RDS for MySQL instance or a self-managed MySQL database by using logical backup.

Usage notes

If you want to restore data to an existing database instance, make sure that the database account specified when you configure the restore task has the permissions on the destination database. Otherwise, the restore task may fail. For more information, see Account permissions.

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 ID of your backup schedule 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 of the Create Restore Task wizard, configure the parameters and click Next. The following table describes the parameters.

    Note

    In this example, backup data is restored to a new database instance. If you set the Target database instance type parameter to Use Exists, you must configure more parameters. For more information, see Table 1 in the Back up an ApsaraDB RDS for MySQL instance or a self-managed MySQL database by using logical backup topic.

    恢复数据库-MySQL

    Section

    Parameter

    Description

    N/A

    Task Name

    The name of the restore task. DBS automatically generates a task name. We recommend that you specify a name that can help you identify the task. Task names do not need to be unique.

    Set Time Restored To

    Time Range Available to Restore

    The time range from the point in time when the first full backup set is created to the point in time when the latest full backup set is created. The database can be restored to a point in time within the time range.

    Restore To

    The point in time to which you want to restore the source database. The value must be within the time range that is specified by the Time Range Available to Restore parameter.

    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.

    Configure Destination Database

    Target database instance type

    The type of the database instance to which you want to restore data. Valid values: New(Recommend) and Use Exists.

    Note

    If you select Use Exists, make sure that the destination database is available when you perform the restore operation.

    Database Location

    The location of the new database instance. In this example, RDS Instance is selected.

    Instance Region

    The region in which the new database instance resides.

    VPC

    The virtual private cloud (VPC) in which the new database instance is deployed.

    Note

    For information about how to create a VPC, see Create and manage a VPC.

    DB InstanceClass

    The type of the new database instance. Select an instance type from the available instance types that are displayed in the DBS console.

    Note

    We recommend that you select the same instance type as that of the source database instance or an instance type with higher specifications.

    Storage Space(GB)

    The storage space of the new database instance. Select a size from the available storage space sizes that are displayed in the DBS console.

    Note

    To ensure that the database instance has enough space for restoration, we recommend that you select a storage space size that is at least 1.3 times the size of the source database instance or five to six times the size of the DBS full backup set. Data is compressed when DBS performs backup.

    You can view the size of the full backup set in the DBS console. Log on to the DBS console. In the left-side navigation pane, click Backup Schedules. On the Backup Schedules page, find the backup schedule of the source database and click backup schedule name. In the left-side navigation pane, choose Backup Tasks > Full Data. On the page that appears, you can view the size of the full backup set. For more information, see View backup plans.

    Compliance warranty regarding cross-border data transfers

    Read the statement of compliance and select I have read and agree to the preceding compliance commitment.

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

    Parameter or setting

    Description

    Conflict Handling

    By default, Rename Object with the Same Name is selected for the Conflict Handling parameter. For example, if the job_info table shares the same name with another table during the restoration, the system renames the new table to job_info_dbs_<restoration task ID>_</timestamp> by default.

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

    Note

    DBS allows you to restore a single database or table. This reduces the amount of data to be restored and shortens the recovery time objective (RTO).

  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.

    Note

    The amount of time used to restore a database depends on the specifications of the backup schedule and the size of the database. Higher specifications offer a higher restoration speed. 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 API operations

API operation

Description

CreateRestoreTask

Creates a restoration task.

StartRestoreTask

Starts a restoration task.

DescribeRestoreTaskList

Views restoration tasks.