Restoring a Database Using a Temporary Instance

Summary

Learn how to restore a database effectively using a temporary instance on Alibaba Cloud ApsaraDB for RDS

Data in your database will unavoidably grow with changes to your business and the elapse of time. Alibaba Cloud ApsaraDB for RDS provides a very stable data backup mechanism. Data backup may still be lost in actual operations due to maloperation or other reasons. By creating a temporary instance to restore database to a time point, a feature provided by RDS, you can retrieve data more easily.

 

When you experience data loss while using an ApsaraDB for RDS instance, do not use a backup to perform an overwriting restoration operation unless you are certain that the data in the backup is sufficient to meet your requirements. After you directly use the backup set to overwrite and restore the instance, usually you will be unable to create a temporary instance in the console for the maloperation time point. Therefore, we recommend you restore the instance by creating a temporary instance at a time point.

 

ApsaraDB for RDS offers two data restoration solutions as follows respectively:

 

Solution 1: The data at the time point is able to meet business requirements and data at that time point can be directly used to overwrite the target database (or the target table).

Step 1: Create a temporary instance

2151926f27c6b0816be6d87100afbe978b7e1069

Step 2: Select to create a temporary instance by time and specify a time point. 

8d0d6598f85f6dff50454a8d2bc16e07be272e93

Note: There are two conditions for creating a temporary instance. 1. There is a full backup before the time point; 2. No instance restoration (overwriting restoration) operations are performed during the time period between the two adjacent backup sets before and after the specified time point.

After specifying the date and time, click Create Temporary Instance, and refresh the current page:

094c7e5d79742464b2e6e307e831a5c18864fff3

You can check the progress of the created task in the upper right corner:

000c011afa563874d9e93c0aa19bef6cb4d2dd09

Note: Creating a temporary instance usually requires the incremental data starting from the backup time point of the app. Therefore, if the incremental data size between the specified time point and the backup time point is large, or if the instance data size is large, it may take a long time for creating the temporary instance. Wait in patience.

 

Step 3: After the task is completed, refresh the page:

6b30734b2313aeef387e2df7857a36f2ba0426ec

If the data at the time point can meet business requirements (the normal incremental data after the time point can be discarded), you can directly click the "Migrate Temporary Instance to Master Instance Database" button to migrate the database (or alarm table) from the temporary instance to the master instance via the DTS tool (you can ignore Step 4 and its subsequent steps).

 

Solution 2: It is required to keep the normal record changes in the target database (or the target table) after the maloperation time point, and restore the deleted records.

 

The first three steps are the same as those in Solution 1. After the temporary instance is created:

 

 Step 4: Retrieve the data that was accidentally deleted and keep incremental data as appropriate.

Click the button in red to check temporary database information,

40f05f01c401de0de425ea260a358cd4fd3cf50e

Check the temporary database information

16a154d14933c82caf07dcd5af27836259fd129d

Select the desired database for logon, and log on to the temporary instance through database client,  the following sample is screenshot with MySQL Front.

f151fd5a1a38ba285ddfcac7b0846988f96d4828

Step 5: Retrieve the data that was accidentally deleted through the SQL window.

15fd73e8a626cb0868045cda1018ad5052bf702c

Import the exported SQL to the master instance through MySQL Front or other tools to complete data restoration.