Restoring Replica Set Database and Table to a Point in Time
Scenarios
To ensure data integrity and reduce impact on the original instance performance, the system restores the full and incremental data at the selected time point to a temporary DB instance, automatically exports the databases and tables to be restored, and then restores the databases and tables to the original DB instance. The time required depends on the amount of data to be backed up and restored on the DB instance. Please wait.
Restoring databases and tables will not overwrite data in the DB instance. You can select databases and tables to be restored.
Restoration Precautions
- After a successful restoration, a new table named Original table name_bak_Timestamp is generated in the DB instance by default. If the table contains an index, the namespace of the index is changed to Original database name.Original table name_bak_Timestamp. You can rename the table later as required.
- New databases and tables will be generated in the original DB instance. Ensure that sufficient storage space is available.
- The length of Database name.Table name is no more than 120 characters. The length of Database name.Table name.Index name is no more than 128 characters. To avoid restoration failure, ensure that the name length meets the requirements.
- Ensure that the name of the restored table is different from that of the existing table. Otherwise, the restoration may fail.
- If you perform a table-level restore and the table does not exist at the required time point, an empty table is automatically created. If you perform a database-level restore, the empty table is not created.
Constraints
Currently, only DDS Community Editions 3.2 and 3.4 support the point-in-time recovery at the database and table level for replica set instances.
Before performing the restoration, you need enable the automated backup policy.
Procedure
- Log in to the DDS console.
- On the Instance Management page, click the target replica set instance.
- In the navigation pane on the left, click Backups & Restorations.
- On the Backups & Restorations page, click Restore Database and Table.
- In the displayed dialog box, configure parameters as required.
Table 1 Database information Parameter
Description
Date
Date when the automated backup of the DB instance is generated.
Time Range
Time range during which the automated backup can be restored.
Time Point
Time point when the automated full backup is generated in the specified time range.
Base Time Range
Time range during which the database and table can be restored based on the automated full backup.
Database and Table
Databases and tables that have been automatically backed up in the base time range are displayed in the left area. Select the databases and tables on the left to sync information to the area on the right.
Time Point
Time point in the base time range.
Custom Database and Table
You can add custom databases and tables as required.
- The system database cannot be restored. Therefore, the database name cannot be admin or local.
- The database name cannot contain spaces and the following special characters: ".\/$
- The table name cannot contain the dollar sign ($) or "system." in prefix.
- The length of Database name.Table name is no more than 120 characters. The length of Database name.Table name.Index name is no more than 128 characters. To avoid restoration failure, ensure that the name length meets the requirements.
- Ensure that the name of the restored table is different from that of the existing table. Otherwise, the restoration may fail.
- After a successful restoration, a new table named Original table name_bak_Timestamp is generated in the DB instance by default. If the table contains an index, the namespace of the index is changed to Original database name.Original table name_bak_Timestamp. You can rename the table later as required.
Distinct the time point of the custom databases and tables from those synchronized to the right area. You are advised to set the time point to different value. The system restores data to the custom databases and tables based on the time point.
Type
You can restore data to a database or table.
If you perform a table-level restore and the table does not exist at the required time point, an empty table is automatically created. If you perform a database-level restore, data will be restored to the database separately, and the table will not be created.
Click OK to start the restoration. The data in the new database and table is the same as that in the database and table at the selected time point.
Figure 1 Selecting database and table
- On the Instance Management page, the DB instance status is Restoring. During the restoration process, services are not interrupted.
- After the restoration is successful, manage data in the database and table as required.
If you need to use the original database and table names, you can perform the rename operation to back up the original database and table and switch your service to the restored database and table. Then, delete the original database and table after ensuring that your services are normal.
Example:
db.adminCommand({renameCollection: "db1.test1", to: "db2.test2"})
The above command is used to move the test1 table from the db1 database to the db2 database and rename the table to test2.
Last Article: Restoring Replica Set Instance to a Point in Time
Next Article: Restoring Replica Set Instance to a Local Self-Built Database
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.