All Products
Search
Document Center

ApsaraDB RDS:Restore individual databases and tables of an ApsaraDB RDS for MySQL instance

Last Updated:Oct 27, 2023

ApsaraDB RDS for MySQL supports the standard restoration feature and the fast restoration feature for individual databases and tables. You can restore specific databases and tables of your ApsaraDB RDS for MySQL instance to the original RDS instance or a new RDS instance by backup set or point in time. The features can be used in scenarios when misoperations are performed and data needs to be quickly restored or when historical data needs to be analyzed.

Feature description

The standard restoration feature and the fast restoration feature for individual databases and tables are provided. The fast restoration feature for individual databases and tables is implemented by using performance-type sandbox instances. If the volume of data remains unchanged, the fast restoration feature for individual databases and tables accelerates data restoration by approximately 50% to 95% compared with the standard restoration feature for individual databases and tables. For more information, see Use the emergency recovery feature of an ApsaraDB RDS for MySQL instance and Restore individual databases and tables of an ApsaraDB RDS for MySQL instance.

image

Item

Standard restoration feature for individual databases and tables

Fast restoration feature for individual databases and tables

Restoration range

Specific databases and tables of an RDS instance.

Specific databases and tables of an RDS instance.

Restoration destination

  • If your RDS instance uses local disk, you can restore data to the original RDS instance or a new RDS instance.

  • If your RDS instance uses cloud disks, the standard restoration feature for individual databases and tables is not supported.

  • If your RDS instance uses local disks, you can restore data only to the original RDS instance.

  • If your RDS instance uses cloud disks, you can restore data only to the original RDS instance. The feature is in public preview and is provided free of charge.

Restoration speed

The restoration speed varies based on the data volume. Data restoration is relatively slow.

The restoration speed varies based on the data volume. Data restoration is accelerated by approximately 50% to 95% compared with the standard restoration feature for individual databases and tables.

Restoration method

You can restore data from backup sets or to a specific point in time.

  • Free edition: You can restore data from backup sets or to the point in time at which the last full data backup is performed.

  • Paid edition: You can restore data from backup sets or to a specific point in time.

Note
  • You can restore data to any point in time within the log backup retention period only after the log backup feature is enabled for your RDS instance. For more information, see Enable the automatic backup feature for an ApsaraDB RDS for MySQL instance. If the log backup feature is disabled, you can restore data only to the point in time at which the data is backed up.

  • The restoration range varies based on data backup retention period, log backup retention period, and the point in time at which you enable the restoration feature for individual databases and tables of your RDS instance. The maximum retention period is 730 days for both data backup files and log backup files. For more information, see Back up an ApsaraDB RDS for MySQL instance. You can call the DescribeLocalAvailableRecoveryTime operation to query the time range within which an RDS instance can be restored. For more information, see DescribeLocalAvailableRecoveryTime.

  • For more information about data restoration methods, see Overview of data restoration methods.

Prerequisites

Standard restoration feature for individual databases and tables

  • If this is the first time you use the backup feature of ApsaraDB RDS, you must attach the AliyunServiceRoleForDBS policy by using your Alibaba Cloud account. For more information, see How do I create a service-linked role for DBS?

  • The following requirements are met:

    • The RDS instance runs MySQL 8.0, MySQL 5.7, or MySQL 5.6.

    • The RDS instance runs RDS High-availability Edition or runs MySQL 5.7 on RDS Enterprise Edition.

    • The RDS instance uses local disks.

    Note
  • The number of tables that are created in the RDS instance is less than 50,000.

  • The restoration feature for individual databases and tables is enabled for the RDS instance. You can go to the Backup and Restoration page and enable the feature in the Basic Backup section of the Backup Strategy tab.

    Important
    • By default, the restoration feature for individual databases and tables is enabled for new RDS instances and cannot be disabled.

    • The backup data that is generated before you enable the restoration feature for individual databases and tables cannot be used to restore individual databases and tables. You can restore full data of an RDS instance. For more information, see Restore full data of an ApsaraDB RDS for MySQL instance.

    • After you enable the restoration feature for individual databases and tables, you must manually back up full data of your RDS instance. Then, you can use the backup data that is generated after you enable the feature to restore specific databases and tables. For more information, see Manually back up an ApsaraDB RDS for MySQL instance.

Fast restoration feature for individual databases and tables

Cloud disks

  • If this is the first time you use the backup feature of ApsaraDB RDS, you must attach the AliyunServiceRoleForDBS policy by using your Alibaba Cloud account. For more information, see How do I create a service-linked role for DBS?

  • The following requirements are met:

    • The RDS instance runs MySQL 5.7 or MySQL 8.0.

    • The RDS instance runs RDS Basic Edition or RDS High-availability Edition. Serverless RDS instances are not supported.

    • The RDS instance uses cloud disks.

    • The RDS instance resides in one of the following regions: Singapore, China (Hohhot), China (Chengdu), China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), and China (Shenzhen).

    Note

    You can go to the Basic Information page of your RDS instance to view the preceding information.

  • The fast restoration feature for individual databases and tables is enabled for the RDS instance. You can go to the Backup and Restoration page and enable the feature in the Basic Backup section of the Backup Strategy tab. For more information, see Restore individual databases and tables of an ApsaraDB RDS for MySQL instance.

Local disks

  • If this is the first time you use the backup feature of ApsaraDB RDS, you must attach the AliyunServiceRoleForDBS policy by using your Alibaba Cloud account. For more information, see How do I create a service-linked role for DBS?

  • The following requirements are met:

    • The RDS instance runs MySQL 8.0, MySQL 5.7, or MySQL 5.6.

    • The RDS instance runs RDS High-availability Edition.

    • The RDS instance uses local disks.

    • The RDS instance resides in one of the following regions: China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Hohhot), and China (Shenzhen).

    Note

    You can go to the Basic Information page of the RDS instance to view the preceding information.

  • The RDS instance runs the InnoDB storage engine.

  • The capacity-type sandbox feature is disabled for the RDS instance. If the feature is enabled, you must disable the feature. For more information, see Use the emergency recovery feature of an ApsaraDB RDS for MySQL instance.

  • The fast restoration feature for individual databases and tables is enabled for the RDS instance. You can go to the Backup and Restoration page and enable the feature in the Basic Backup section of the Backup Strategy tab. For more information, see Restore individual databases and tables of an ApsaraDB RDS for MySQL instance.

    Important
    • By default, the restoration feature for individual databases and tables is enabled for new RDS instances and cannot be disabled.

    • The backup data that is generated before you enable the restoration feature for individual databases and tables cannot be used to restore individual databases and tables. You can restore full data of an RDS instance. For more information, see Restore full data of an ApsaraDB RDS for MySQL instance.

    • After you enable the restoration feature for individual databases and tables, you must manually back up full data of your RDS instance. Then, you can use the backup data that is generated after you enable the feature to restore specific databases and tables. For more information, see Manually back up an ApsaraDB RDS for MySQL instance.

Billing rules

Standard restoration feature for individual databases and tables

By default, the standard restoration feature for individual databases and tables is enabled and is provided free of charge. If you use the standard restoration feature to restore individual databases or tables to a new RDS instance, you are charged for the new RDS instance. You can view the billing details when you create the RDS instance.

Note

Fast restoration feature for individual databases and tables

  • RDS instances with cloud disks: This feature is in public review and is provided free of charge.

  • Local disks

    • Free edition: If you enable and use the fast restoration feature for individual databases and tables of this edition, no fees are generated.

    • Paid edition: If you enable and use the fast restoration feature for individual databases and tables of this edition, you are charged based on the actual data volume by using the pay-as-you-go billing method. Unit price: USD 0.24 per GB-month.

Usage notes

  • By default, the restoration feature for individual databases and tables is enabled for new RDS instances that use local disks and cannot be disabled.

  • If you want to restore data of your RDS instance to a point in time, you must make sure that the log backup feature is enabled for the instance. For more information, see Enable the automatic backup feature for an ApsaraDB RDS for MySQL instance.

  • If you use the fast restoration feature for individual databases and tables to restore individual databases or tables of an RDS instance, you can restore the data only to the original RDS instance rather than a new RDS instance.

  • If your RDS instance uses local disks, the backup data that is generated before you enable the restoration feature for individual databases and tables cannot be used to restore individual databases and tables. You can restore full data of your RDS instance. For more information, see Restore full data of an ApsaraDB RDS for MySQL instance.

  • If your RDS instance uses local disks, you must manually back up full data of your RDS instance after you enable the restoration feature for individual databases and tables. Then, you can restore individual databases and tables from the backup data that is generated after you enable restoration feature for individual databases and tables. For more information, see Manually back up an ApsaraDB RDS for MySQL instance.

    Note

    After you enable the restoration feature for individual databases and tables, the backup file format is changed from TAR to xbstream.

  • If you restore data of your RDS instance that uses local disks to the same RDS instance, a primary/secondary switchover is triggered during the restoration. The switchover may cause a transient connection that lasts for approximately 30 seconds. Make sure that your application is configured to automatically reconnect to the RDS instance. If you restore data of the RDS instance to a new RDS instance, no primary/secondary switchovers are triggered during the restoration.

    Important

    If you use the fast restoration feature for individual databases and tables to restore data of your RDS instance that uses cloud disks to the same RDS instance, no primary/secondary switchovers are triggered during the restoration. However, in some cases, the performance of the RDS instance may decrease and transient connections may occur.

  • You cannot suspend or cancel a restoration task after it is initiated.

Enable the fast restoration feature for individual databases and tables

To use the fast restoration feature for individual databases and tables for data restoration, you must perform the following steps to enable the feature and then restore data. Enabling the feature does not affect your workloads.

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane of the page that appears, click Backup and Restoration.

    Note
    • If your RDS instance uses local disks, the free and paid editions are provided for the fast restoration feature for individual databases and tables. The free edition allows you to restore data only to the point in time at which the last full backup is performed. The paid edition allows you to restore data to any point in time. For more information about billing, see Billing rules.

    • If the [Notice] Fast Restoration Becomes Commercially Available and Billed dialog box appears, you can select Do not show again. and then enable the free or paid edition based on your business requirements. If the dialog box does not appear, you can proceed with the subsequent steps.

  3. On the Backup and Restoration page that appears, click the Backup Strategy tab.

  4. In the Base Backup section, click Edit. In the dialog box that appears, turn on Fast Restoration.

    Note
    • For RDS instances that use local disks, if Database/Table Restoration is turned off, the Restore Speed option is not displayed. You must turn on Database/Table Restoration. For more information, see Usage notes.

    • If your RDS instance uses local disks, you must configure the CDM Billing Method and CDM Retention Period parameters.

      • Free edition: Set the CDM Billing Method parameter to Previous Full Backup Point in Time (Free Edition). The restored data is retained for one day.

      • Paid edition: Set the CDM Billing Method parameter to Any Point in Time (Paid Edition). You can set the retention period of restored data to 1 to 730 days.

  5. Click OK.

Procedure

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the left-side navigation pane, click Backup and Restoration. On the page that appears, click Restore Individual Database/Table.

    Note

    If the Restore Individual Database/Table button is not displayed in the ApsaraDB RDS console, check whether the requirements that are described in the Prerequisites section are met.

  3. Configure the following parameters.

    Parameter

    Description

    Restore to

    • Current Instance

    • Restore to a New Instance: Follow Step 5 to automatically create an RDS instance. The databases and tables are restored to the new RDS instance. The restoration does not affect the original RDS instance.

      After you verify the data in the new RDS instance, you can migrate the data back to the original RDS instance. For more information, see Migrate data between ApsaraDB RDS for MySQL instances.

    Note

    The New Instance option is available only for RDS instances that use local disks.

    Restore Speed

    Note
    • If your RDS instance uses cloud disks, you can set the Restore Speed parameter only to Fast. The fast restoration feature for individual databases and tables is now in public preview. You can use the feature free of charge.

    • If you use the fast restoration feature for individual databases and tables to restore individual databases or tables of an RDS instance, you can restore the data only to the original RDS instance rather than a new RDS instance.

    Restore Method

    • By Backup Set: If you select this option, you can restore the data from a data backup file.

    • By Time: If you select this option, the system restores full backup data and then incremental log backup data. You can select any point in time within the log backup retention period. For information about how to view or change the log backup retention period, see Enable the automatic backup feature for an ApsaraDB RDS for MySQL instance.

      For example, if both the data backup retention period and the log backup retention period of an RDS instance are seven days, you can restore data that is generated within seven days. Backup sets that are generated seven days ago are not retained and cannot be restored.

      Note

      The By Time option is available only after the log backup feature is enabled. For more information about how to enable the feature, see Enable the automatic backup feature for an ApsaraDB RDS for MySQL instance.

  4. Select the databases and tables that you want to restore. You can also specify the name of each restored database or table. Then, click OK.

    Note
    • You can select up to 50 databases or tables at a time.

    • When you restore databases and tables to the original RDS instance, the names of the restored databases can be the same as the names of the original databases, but the names of the restored tables cannot be the same as the names of the original tables. By default, the system adds _backup to the name of a restored database. You can rename the restored database or table.

    • If you restore databases and tables to the original RDS instance, you must make sure that the available storage of the RDS instance is sufficient to store the data of the databases and tables.

  5. Select a billing method and configure the parameters related to the new RDS instance. This step is required only when you select New instance and Standard.

    • Subscription: A subscription instance is an instance for which you pay an upfront fee. For long-term use, the subscription billing method is more cost-effective than the pay-as-you-go billing method.

    • Pay-as-you-go: You are charged an hourly fee for a pay-as-you-go instance based on your actual resource usage. The pay-as-you-go billing method is suitable for short-term use. If you no longer need a pay-as-you-go instance, you can release the instance to reduce costs.

    Parameter

    Description

    Zone

    The zone where the new RDS instance resides. Each zone is an independent physical location within a region. Zones in the same region do not have substantial differences.

    The new RDS instance can reside in the same zone as the Elastic Compute Service (ECS) instance that you want to connect or in a different zone.

    Note

    The new RDS instance must reside in the same region as the original RDS instance. You cannot change the region.

    Instance Type

    The instance type of the new RDS instance. Each instance type supports a different number of CPU cores, memory capacity, maximum number of connections, and maximum IOPS. For more information, see Primary ApsaraDB RDS instance types.

    Capacity

    The amount of storage that is provisioned to store data files, system files, log files, and transaction files in the new RDS instance.

    Network Type

    • Classic Network: the traditional type of network.

    • VPC: the recommended type of network. A virtual private cloud (VPC) is an isolated virtual network that provides higher security and higher performance than the classic network.

    Note

    You can go to the Tasks page to view the creation progress of the RDS instance. You can also use one of the following methods to restore individual databases and tables:

Correct the online data

Restoration destination

Correction method

Current Instance

Execute the RENAME TABLE statement to rename the restored table.

New Instance

After you restore the data of the original RDS instance to the new RDS instance, you can use Data Transmission Service (DTS) to migrate some or all data of the required databases and tables to the original RDS instance to correct the online data of the original RDS instance. For more information, see Migrate data between ApsaraDB RDS for MySQL instances.

Note

When you create a data migration task, use the new RDS instance as the source database and the original RDS instance as the destination database and set the Access Method parameter for both the source and destination databases to Alibaba Cloud Instance.

FAQ

  • What do I do if the "The operation failed. The RDS instance is not in a ready state." error message is displayed when I restore a database or table of my RDS instance in the ApsaraDB RDS console?

    Tasks in the ApsaraDB RDS console are executed in sequence. If an ongoing restoration task or incomplete task exists, this error message is displayed when you execute another restoration task at the same time. In this case, wait until the ongoing restoration task or incomplete task is complete and then execute another restoration task.

  • What do I do if the restored table is empty?

    Make sure that the table contains data at the point in time that you selected for the restoration. If the table does not contain data at the point in time that you selected for the restoration, you must select a table that contains data at the selected point in time.

  • How do I restore data that is accidentally deleted from an RDS instance?

    You can use the data tracking feature of Data Management (DMS) to identify data changes in a specific period of time and generate SQL statements for rolling back the data changes. Then, you can submit a data change ticket to change data in the RDS instance by executing the generated SQL statements. For more information, see Use the data tracking feature of DMS to restore the data of an ApsaraDB RDS for MySQL instance and Change regular data.

  • After I log on to the ApsaraDB RDS console as a RAM user, I cannot find the Restore Individual Database/Table button on the Backup and Restoration page. What do I do?

    If you cannot use the Restore Individual Database/Table button on the Backup and Restoration page, check whether the AliyunDBSFullAccess policy is attached to the RAM user. For more information about how to grant permissions to a RAM user, see Grant permissions to a RAM user.

  • How do I determine whether to use the restoration feature for individual databases and tables or the emergency recovery feature?

    If data of your RDS instance is accidentally deleted or modified, or the data is lost or damaged due to other unexpected events, you can use the restoration feature for individual databases and tables to restore specific databases and tables of the RDS instance to a specified point in time. This feature is suitable for scenarios in which you want to restore specific databases and tables. For example, if some data of your RDS instance is lost due to misoperations, you can use this feature to restore only the affected tables.

    If data of your RDS instance is lost or damaged due to misoperations or other unexpected events, you can use the emergency recovery feature to restore data of the RDS instance to a specified point in time. This feature is suitable for emergency cases of data loss or data damage. For example, the data is accidentally deleted or modified. If you use this feature, you must also enable the sandbox feature.

    Note

    You cannot enable the fast restoration feature for individual databases and tables and the emergency recovery feature at the same time. You can enable only one of the features based on your business requirements. For more information about data restoration methods, see Overview of data restoration methods.

  • Do I have other methods to restore individual databases and tables of an RDS instance that uses cloud disks?

    Yes, you can use DBS to back up and restore databases on your RDS instance or self-managed databases on ECS instances. You can also use DBS to download backup files to your on-premises computer. For more information, see Overview.

    Note

    For more information about how to restore databases and tables, see Restore data by database or table or How to back up or restore the databases of an ApsaraDB RDS for MySQL instance.

Related operations

Operation

Description

RestoreTable

Restores the specified individual databases and tables of an instance to the original instance.

CloneDBInstance

Restores the specified individual databases and tables of an instance to a new instance.

DescribeLocalAvailableRecoveryTime

Queries the time range within which you can restore data by using a backup file of an instance.