All Products
Search
Document Center

Database Backup:Restore a database

Last Updated:Feb 29, 2024

Database Backup (DBS) allows you to restore data from backups to cloud databases, on-premises databases, or DBS sandbox instances by creating restore tasks. You can use this feature to restore a database after an accidental operation and analyze historical data.

Prerequisites

Billing

The restoration feature is available free of charge. However, if you restore a database to a new ApsaraDB RDS instance, you are charged for the new instance. The new instance fees are related to the selected instance type and storage space. The actual fees on your bills prevail.

Usage notes

  • If you use a DBS backup schedule that is created in a region to restore a database to an ApsaraDB RDS instance in another region, make sure that the destination ApsaraDB RDS instance is accessible over a public endpoint.

    For example, if a DBS backup schedule is created in the China (Hangzhou) region and you want to use the DBS backup schedule to restore data to an ApsaraDB RDS instance in the China (Beijing) region, make sure that the ApsaraDB RDS instance in the China (Beijing) region is accessible over a public endpoint.

  • 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. The restoration duration is longer if the database to be restored is larger. For more information, see Performance tests on backup and restoration.

Procedure

Note
  • This example describes only a general procedure for restoring databases. The specific restoration procedure varies based on database engines. For more information about the backup and restoration scenarios for different database engines, see Backup and restoration overview.

  • DBS also provides the sandbox feature based on the copy data management (CDM) technology. This feature allows you to restore databases with a recovery time objective (RTO) of several seconds. You can analyze, test, and verify data in a sandbox instance. For more information, see Restore a self-managed MySQL database in an emergency.

  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 of the Create Restore Task wizard, configure the parameters in the Set Time Restored To and Configure Destination Database sections. Then, click Next in the lower-right corner of the page.

    Note
    • The specific restoration procedure varies based on database engines. For more information about the backup and restoration scenarios for different database engines, see Backup and restoration overview.

    • DBS allows you to restore a database such as a MySQL or SQL Server database to a new ApsaraDB RDS instance without the need to create the instance in advance.

  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.

    image

    Note
    • The duration of the restoration depends on the specification of the backup schedule and the size of the database. Less time is required for the restoration of 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 directly create, start, or view a restoration task by calling an API operation. For more information, see CreateRestoreTask, StartRestoreTask, or DescribeRestoreTaskList.

  • If the backup data at the specified point in time does not meet your business requirements, you can click Start Full Data Backup in the upper-right corner of the Full Data page to manually back up the database. After the backup is complete, configure a restoration task to restore the database to the point in time of the latest full backup.

  • If an exception or error occurs in the restoration task, refer to Common Errors and Troubleshooting for troubleshooting.

FAQ

What do I do if the precheck fails due to the server_id check failure when I restore a database?

Check whether the value of the server_id parameter in the database to be restored is greater than 1. If the value of the server_id parameter in the database to be restored is not greater than 1, you can execute the set global server_id = 2 SQL statement to modify the value and perform the precheck again.

What do I do if a restore task fails? How do I troubleshoot the issue?

  • In most cases, a restore task fails due to the following causes:

    • Cause 1: An object to be restored in the source database and an existing object in the destination database have the same name.

    • Solution: When you configure a restore task, set the Conflict Handling parameter to Rename Object with the Same Name.

    • Cause 2: The network of the server on which the database to be restored resides is abnormal.

    • Solution: Check the network of the database server and try to troubleshoot the issue that is found. If you cannot find a solution to your issue or the issue persists after troubleshooting, you can join the DBS DingTalk group (ID 35585947) for technical support.