All Products
Search
Document Center

Database Backup:Restore a self-managed MySQL database in an emergency

Last Updated:May 18, 2023

Database Backup allows you to use the sandbox feature to restore self-managed MySQL databases that run MySQL 5.7 or 8.0. This way, you can restore data in a quick manner. Read and write operations that are performed in each sandbox instance do not affect data in other sandbox instances or source databases.

Prerequisites

  • A self-managed MySQL database that runs MySQL 5.7 or 8.0 is added as a data source. For more information about how to add a data source, see Add a data source.

  • A backup schedule is created, and at least one full backup task is complete. For more information, see Back up databases.

  • The backup schedule is in the Running state.

  • A virtual private cloud (VPC) is created. The VPC is used to access the sandbox instance. For more information, see Create and manage a VPC.

Background information

The sandbox feature is integrated with the data deduplication feature and storage virtualization feature to help reduce storage costs and overall costs for data backup. The data deduplication feature and incremental data merge feature ensure that full backup data is available for the server. The storage virtualization feature can provide replicas of full backup data for read and write operations without the need to copy data. For more information about the features, common scenarios, pricing, and limits of sandbox instances, see Overview.

This topic describes how to restore a self-managed MySQL database that runs MySQL 5.7 or 8.0 in an emergency. For information about how to restore an ApsaraDB RDS for MySQL database in an emergency, see Use the emergency recovery feature of an ApsaraDB RDS for MySQL instance.

To restore a self-managed MySQL database in an emergency, perform the following steps:

Pricing

You are charged based on the following two billable items: sandbox storage and RDS instance. The following table describes the pricing details.

Billable item

Description

Sandbox storage

After you enable the sandbox feature, DBS automatically synchronizes the data that is backed up to the sandbox storage and generates snapshots for the data. DBS charges you for data storage based on the volume of the data that is stored in the sandbox storage. For more information, see DBS sandbox fees.

RDS instance

You are charged for the new RDS instance to which data is restored. The instance uses the pay-as-you-go billing method. You are charged RDS instance fees only when you restore data to an RDS instance.

Enable the sandbox feature

Before you create an RDS instance as a sandbox instance and restore data to the RDS instance, you must perform the following steps to enable the sandbox feature in the DBS console. For more information, see the Restore data to an RDS instance section of this topic.

  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, click Manage in the Actions column corresponding to a backup schedule.
  4. On the Configure Task page, click Set Sandbox Feature in the Sandbox Information section.

  5. In the Set Sandbox Policy dialog box, turn on Sandbox function and configure the Sandbox Data Retention Period parameter.

    Parameter

    Description

    Sandbox function

    Turn on Sandbox function.

    Sandbox Data Retention Period

    The number of days for which DBS retains data. You can use the retained data to create sandbox instances. Default value: 7. By default, DBS retains the data that is stored in the previous seven days. If you set this parameter to 0, DBS retains only the latest data snapshot.

  6. Click OK.

    After you enable the sandbox feature, the value of the Sandbox instance time range parameter changes to Data preparing. The first time you enable the sandbox feature for a backup schedule, DBS stores the latest full backup set to the sandbox storage and generates a snapshot that can be used to create sandbox instances. DBS requires a specific period of time to copy data. The period of time varies based on the size of the backup data and may be 5 to 20 minutes.

    After a specific time range is displayed as the value of the Sandbox instance time range parameter, you can create a sandbox instance to restore data to a specific point in time in the time range. The following table describes the values of the Sandbox instance time range parameter.

    Sandbox status

    Description

    Sandbox feature disabled

    The value of the Sandbox instance time range parameter is Unopened.

    Preparation after you enable the sandbox feature

    The value of the Sandbox instance time range parameter changes to Data preparing.

    Preparation completed

    The value of the Sandbox instance time range parameter changes to the time range in which available backup sets are created.

    Note

    The time range is from the start time of the earliest backup to the end time of the latest backup.

Restore data to an RDS instance

  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 to restore data and click Manage in the Actions column.

  4. On the Sandbox Instance Tasks page, click Restore Sandbox Instance.

  5. In the Restore Sandbox Instance dialog box, configure the following parameters.

    Section

    Parameter

    Description

    Sandbox Instance Point in Time

    Sandbox Data Time Range

    The time range in which available backup sets are created. The available time range is from the point in time at which the first snapshot was created in the sandbox storage to the current point in time. The actual available time range may be shorter. Data can be restored in the time range from the point in time at which the first snapshot was created in sandbox storage to the end time of the latest binary log file. Data may not be restored in the time range from the end time of the latest binary log file to the current point in time. You can view the end time of the latest binary log file on the Log Backup tab of the Backup and Restoration page.

    Recovery Method

    • Recovery by Snapshot Point in Time: You can select only the point in time at which a snapshot was created. This method takes less time to complete.

    • Recovery by Custom Point in Time: If incremental log backup is enabled, you can restore data to a specific point in time within the time range that is specified for the Available Time Range to Recover parameter. The time required for the restoration varies based on the backup size.

      If incremental log backup is disabled, you can restore data only to the point in time at which a full backup set was created.

    Sandbox Instance Configurations

    Type of Sandbox Instance

    The fixed value is ApsaraDB RDS Instance.

    Edition

    The edition of the RDS instance. For more information, see Overview.

    Peer VPC

    The ID of the VPC in which you want to deploy the RDS instance.

    If you want to access the RDS instance by using your Elastic Compute Service (ECS) instance, you must set this parameter to the ID of the VPC in which the ECS instance is deployed. For more information about how to create a VPC, see Create and manage a VPC.

    Peer VSwitch

    The ID of the vSwitch in which you want to deploy the RDS instance. The RDS instance can be accessed from the CIDR blocks that are specified for the vSwitch.

    Specifications

    The specifications of the RDS instance. For more information about instance specifications, see Specifications.

    Region

    The region where you want to deploy the RDS instance. By default, the region where the backup schedule resides is selected.

  6. Click OK.

    DBS checks the configurations of the RDS instance and restores the data to the RDS instance. When the status of the RDS instance changes to Completed, you can access the RDS instance.

  7. Optional. Access the RDS instance.

    Click the endpoint displayed in the Sandbox Instance Address column to go to the ApsaraDB RDS console.

  8. Optional. After your business is complete, release the RDS instance in the ApsaraDB RDS console based on your business requirements. For more information, see Release or unsubscribe from an ApsaraDB RDS for MySQL instance.

Disable the sandbox feature

  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 for which you want to disable the sandbox feature and click Manage in the Actions column.

  4. On the Sandbox Instance Tasks page, click Set Sandbox Policy in the Sandbox Information section.

  5. In the Set Sandbox Policy dialog box, turn off Sandbox function and click OK.

FAQ

Q: After I disable the sandbox feature, does DBS still charges me for sandbox resources?

A: After you release all sandbox instances and disable the sandbox feature, DBS does not charge you for sandbox resources.