This topic describes the methods that you can use to restore data of an ApsaraDB RDS for MySQL instance. You can select a method based on the scenarios in which you accidentally release an ApsaraDB RDS for MySQL instance, delete or modify the data of an RDS instance, or want to restore data of an RDS instance to an on-premises database or the cloud from backup files.
Scenario 1: Restore data of an RDS instance that is released
Recycle Bin: Log on to the ApsaraDB RDS console and go to the Recycle Bin page. In the top navigation bar, select the region in which the RDS instance resides. If you can find the RDS instance on the Locked Instances page, you can rebuild the RDS instance.
Backup for Deleted Instances: If you configure the Retain Backup Files after Instance Release parameter for an RDS instance that uses local disks and was created at least seven days ago, you can download the required backup files on the Backup for Deleted Instances tab to restore the data of the RDS instance. For more information about backup settings, see Enable the automatic backup feature.
Scenario 2: Restore data that is deleted or modified on an RDS instance
Solution | Supported instance | Restoration time | Restoration range | Restoration destination | Restore speed | ||||||
Local disk | Cloud disk | Any point in time | Point in time when the backup set is generated | All databases and tables | Individual databases and tables | To a new RDS instance | To the original RDS instance | To an existing RDS instance | |||
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | ✔️ | ❌ | ❌ | Slow | ||
✔️ | ❌ | ✔️ | ✔️ | ✔️ | ❌ | ✔️ | ❌ | ❌ | Fast | ||
Regular | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | Slow | |
Fast | ✔️ | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | ✔️ | ❌ | Fast |
Restore data to a new RDS instance: If you want to temporarily use the new RDS instance, you can create a pay-as-you-go RDS instance. Restore data to the pay-as-you-go RDS instance, migrate the data to the original RDS instance, and then release the pay-as-you-go RDS instance to reduce costs.
Restore data to the original RDS instance: Data restoration does not overwrite the data of the original RDS instance.
You can also use the data tracking feature of Data Management (DMS) to roll back data by executing SQL statements. For more information, see Use the data tracking feature of DMS to restore the data of an ApsaraDB RDS for MySQL instance.
Scenario 3: View data that exists at a specific point in time in an RDS instance
Fast: You can use the native flashback feature to quickly view data. For more information, see Native flashback.
Fast: You can query data from logical backup files that are generated by Database Backup (DBS). For more information, see Query data from DBS-generated logical backup files.
Fast: Create a DBS sandbox instance to obtain the data backup files of the RDS instance and restore the data of the RDS instance from the data backup files. For more information, see Create a sandbox instance for the emergency disaster recovery of an ApsaraDB RDS for MySQL database. Then, view the data of the RDS instance.
Slow: Restore full data or individual databases and tables. Then, view the data. For more information, see Restore full data of an ApsaraDB RDS for MySQL instance or Restore individual databases and tables of an ApsaraDB RDS for MySQL instance.
Scenario 4: Restore data from backup files to an on-premises database or the cloud
Migrate or restore data to the cloud
Migrate the most recent data.
Migrate data from a self-managed MySQL database to an RDS instance. For more information, see Migrate data from a self-managed MySQL database to an ApsaraDB RDS for MySQL instance.
Migrate historical data.
Restore data of a self-managed MySQL instance to an RDS instance from backup files. For more information, see Restore the data of a self-managed MySQL instance to an ApsaraDB RDS for MySQL instance.
Restore data from the backup files of the RDS instance to an on-premises database. Then, migrate the data from the on-premises database to an RDS instance. For more information, see Migrate data from a self-managed MySQL database to an ApsaraDB RDS for MySQL instance.
Use DBS to create a logical backup. Then, restore data from the generated logical backup file to an RDS instance. For more information, see Restore a MySQL database from a logical backup.
Migrate data of an RDS instance from backup files to an RDS instance that is created by using a different Alibaba Cloud account.
Restore data from backup files to a self-managed MySQL database. Then, use Data Transmission Service (DTS) to migrate the data from the self-managed MySQL database to an RDS instance. For more information, see Restore the data of an ApsaraDB RDS for MySQL instance from a physical backup file to a self-managed MySQL database and Migrate data from a self-managed MySQL database to an ApsaraDB RDS for MySQL instance.
Restore data from backup files to a self-managed MySQL database. Then, use mysqldump to migrate the data from the self-managed MySQL database to an RDS instance that is created by using a different Alibaba Cloud account. For more information, see Restore the data of an ApsaraDB RDS for MySQL instance from a physical backup file to a self-managed MySQL database and Use the mysqldump extension to migrate data from a self-managed MySQL instance to an ApsaraDB RDS for MySQL instance.
Migrate or restore data to an on-premises database
Migrate the most recent data.
Migrate the data of an RDS instance to a self-managed MySQL database. For more information, see Migrate data from an ApsaraDB RDS for MySQL instance to a self-managed MySQL database.
Migrate historical data.
If logical backup files are created by DBS for the RDS instance, restore the data from the logical backup files to an on-premises database. For more information, see Restore a MySQL database from a logical backup.
If the backup files are downloaded from the ApsaraDB RDS console, you can restore data by following the instructions that are provided in Restore the data of an ApsaraDB RDS for MySQL instance from a physical backup file to a self-managed MySQL database or Restore the data of an ApsaraDB RDS for MySQL instance from a logical backup file to a self-managed MySQL instance.
Migrate data of an RDS instance to a different RDS instance
Migrate the most recent data.
Migrate the data of an RDS instance to a different RDS instance. For more information, see Migrate data between ApsaraDB RDS for MySQL instances.
Migrate historical data.
If logical backup files are created by DBS for the source RDS instance, restore the data to the destination RDS instance from the logical backup files. For more information, see Restore a MySQL database from a logical backup.
If only default backup files are created for the source RDS instance, restore the full data of the RDS instance or only the data from specific databases and tables of the RDS instance to the same RDS instance or to a new RDS instance. Then, migrate the data to the destination RDS instance. For more information, see Restore full data of an ApsaraDB RDS for MySQL instance or Restore individual databases and tables of an ApsaraDB RDS for MySQL instance.
Other scenarios
If you need to replicate the backup files of an RDS instance from the source region to a destination region or restore the data of an RDS instance to an existing or new RDS instance that resides in the destination region from a cross-region backup file, you can follow the instructions described in Use the cross-region backup feature and Restore data across regions.
You can also run the
mysqldump
command to back up a specific database of the source RDS instance and export the backup file as an SQL file. Then, you can run themysql
command to restore data to the destination database from the SQL file. For more information, see How do I back up and restore the databases of an ApsaraDB RDS for MySQL instance?