Restoring a Database Using a Temporary Instance

In the era of Big Data, data backup has become an integral part in maintaining the continuity of businesses. However, data that has been backed up may still be lost in actual operations due to misoperations or other unforeseen reasons. Losing data can be costly for an enterprise, especially if its core business relies heavily on data intelligence.

To minimize the possibility of data loss, businesses should consider using enterprise-level databases, such as the Alibaba Cloud ApsaraDB for RDS. With its automated monitoring and data recovery capabilities, ApsaraDB for RDSprovides a very stable data backup mechanism for enterprises.

When you experience data loss while using an ApsaraDB for RDS instance, you can use the backup and recovery feature to undo any misoperations. ApsaraDB for RDS provides two methods for you to restore your data: recovery directly to the master database and recovery through a temporary instance.

You are not recommended to use a direct restoration unless you are certain that the data in the backup is sufficient to meet your requirements. Once completed, you will not be able to undo the changes to your database. Instead, you should perform data restoration through a temporary instance. By creating a temporary instance to restore database to a time point, you can perform multiple tests on the temporary instance to ensure everything is correct.

There are two common scenarios of data restoration on ApsaraDB for RDS:

Scenario 1

The data at the backup time point is able to meet business requirements. In other words, data at that backup time point can be directly used to overwrite the target database (or the target table).

Step 1: Go to the RDS Console and navigate to the Backup and Recovery section.

Image for post
Image for post

Step 2: Go to the Temporary Instance tab. Specify the time point and click on Create Temporary Instance.

Image for post
Image for post

There are two conditions for successfully creating a temporary instance:

  • There is an existing full backup before the data loss.
  • No instance restoration operations (overwriting restoration) are performed after the specified time point.

You can see the progress of the task (written in red) next to the database instance name:

Image for post
Image for post

Note: Creating a temporary instance may take a while if the instance data size is large.

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

Image for post
Image for post

If the data at the time point can meet business requirements, you can proceed by clicking on the Migrate Temporary Instance to Master Instance Database button. Data from the temporary instance will be transferred to the master instance via the Data Transmission Service (DTS) tool. You can safely ignore the following steps (Step 4 and its subsequent steps).

Scenario 2

In the previous scenario, normal incremental data after the time point is discarded. However, sometimes we need to save the data after the backup time point.

To do this, perform the first three steps in Scenario 1. After the temporary instance is successfully created, we need to restore the deleted records.

Step 4: Check the temporary database information.

Image for post
Image for post

Step 5: Select the desired database for logon, and log on to the temporary instance through a database client. In this example, we have performed this step with MySQL Front.

Image for post
Image for post

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

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

That’s it! Database backup and recovery is for enterprise is made quick and convenient with Alibaba Cloud ApsaraDB for RDS and Data Transmission Service. Visit the ApsaraDB for RDS documentation page to learn more about backing up data, or talk to our database experts by visiting this link.

Reference:

https://www.alibabacloud.com/blog/restoring-a-database-using-a-temporary-instance_574209?spm=a2c41.11384742.0.0

Written by

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store