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
Select a restoration method based on when the instance was released (deleted):
Restore through the recycle bin:
For instances that are manually released (deleted), you can rebuild and restore them through the recycle bin within 9 days after they are released.
For subscription instances that have expired or pay-as-you-go instances with overdue payments, you can unlock or rebuild and restore them through the recycle bin within 16 days.
Restore through deleted instance backups:
If you have configured a backup retention policy after instance release, you can download backups for restoration from the Deleted Instance Backups page.
NoteDisk instances: For RDS MySQL disk instances purchased on or after February 1, 2024, the default backup retention policy after instance release is Retain The Last One.
High-performance local disks: For newly purchased RDS MySQL instances with high-performance local disks, the default backup retention policy after instance release is Do Not Retain. You need to manually configure a backup retention policy after instance release.
Scenario 2: Restore data that is deleted or modified on an RDS instance
Method | Supported instances | Restoration point in time | Restoration scope | Restoration destination | Restoration speed | ||||||
High-performance local disk | Disk | Any point in time | Point in time of backup set | All databases and tables | Partial databases and tables | Restore to a new RDS instance | Restore to the original RDS instance | Restore to another existing RDS instance | |||
✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | ✔️ | ❌ | ❌ | Slow | ||
✔️ | ❌ | ✔️ | ✔️ | ✔️ | ❌ | ❌ | ❌ | ❌ | Fast | ||
Standard | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | Slow | |
Ultra-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 DMS to roll back data by executing rollback SQL statements.
Scenario 3: Query data at a specific point in time
Fast: Native Flashback
Fast: RDS MySQL emergency recovery, and then view the data.
Relatively slow: Restore full data or restore databases and tables, and then view the data.
Scenario 4: Restore from backup files to the cloud or on-premises
Migrate/restore to the cloud
Migrate the latest data through DTS
Migrate data from a self-managed MySQL database to an ApsaraDB RDS for MySQL instance
Migrate historical data
Import a full backup of a self-managed database to RDS, and then restore the backup to a new RDS instance.
You can also restore the backup on-premises first, and then migrate from on-premises to RDS.
You can also use Data Disaster Recovery to create a logical backup and then restore it to an RDS instance in the cloud.
Migrate data of an RDS instance from backup files to an RDS instance that is created by using a different Alibaba Cloud account
First restore the backup files to a self-managed database, and then use DTS to migrate from the self-managed MySQL database to an RDS MySQL instance.
First restore the backup files to a self-managed database, and then use mysqldump to migrate MySQL data to an RDS instance under another account.
Migrate/restore to on-premises
Migrate the latest data through DTS
Migrate historical data
If you have a logical backup from Data Disaster Recovery, you can restore it directly on-premises. For more information, see Restore a MySQL logical backup.
If you downloaded a backup from the RDS console, select a restoration method based on the backup method.
Logical backup: Logical backups are used to back up database objects, such as tables, indexes, and stored procedures. You can use various tools to create logical backups, such as mysqldump for MySQL databases and the export and import utility for Oracle databases. For more information, see Restore the data of an ApsaraDB RDS for MySQL instance from a logical backup file to a self-managed MySQL instance.
Physical backup: Physical backups are used to back up database files on the operating systems. You can use various tools to create physical backups, such as XtraBackup for MySQL databases and RMAN for Oracle databases. 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.
Snapshot backup: A snapshot is a replica that is created for the specified data set and can be used in the same way as the original data set. After creating a snapshot backup, you can choose whether to maintain the snapshot on the current server or use it to back up data across servers. You can use various tools to create snapshot backups, such as Veritas File System, Linux LVM, and NetApp NAS. For more information, see Restore the data of an ApsaraDB RDS for MySQL instance to a self-managed MySQL instance by using snapshot backup files.
Migrate between RDS instances
Migrate the latest data through DTS:
Migrate historical data:
If you have a logical backup from Data Disaster Recovery, you can restore it directly to the destination instance. For more information, see Restore a MySQL logical backup.
If you only have default backups, you can restore full data or restore databases and tables to a new instance or the original instance, and then migrate to the destination instance.
Other scenarios
If you need to back up data to another region, or restore data across regions to a new instance or an existing instance in the destination region, see Cross-region backup and Cross-region data restoration.
You can also use the
mysqldump
command to export data from a specified database as an SQL file for backup, and use themysql
command to import data from the SQL file to the destination database for restoration. For more information, see Back up and restore a database by using mysqldump.