Through a complete data backup and a subsequent period of binlog backup, you can roll back a specific database/table to any time point. After confirming the time point when the misoperation occurred, you can use this method to restore the misoperated database or table to the status before the misoperation occurred.
Prerequisites
There are data backup files and log backup files in the backup list. For automatic backup settings, see Automatic Backup. The cluster is in the running status.
Note
For database/table rollback, you need to specify the database/table to be rolled back. If you cannot determine all the involved databases/tables, we recommend that you clone the original cluster and migrate back to it after determining the databases/tables.
If the database/table to be rolled back does not exist at the specified time point, database/table rollback will fail.
If the database/table to be rolled back does not exist or has been dropped, you need to log in to the database and create a database/table first before performing rollback in the console.
If there are primary or foreign key constraints in the specified database/table to be rolled back, please ensure that the associated databases/tables exist during the rollback process; otherwise, database/table rollback will fail.
Up to 500 databases or tables can be rolled back at a time.
Step 1. Obtain the time point of misoperation
If you have enabled the database audit service for TDSQL-C for MySQL cluster, you can determine the time point of SQL execution misoperation by analyzing the audit log.
Step 2. Roll back databases/tables
2. Select a region at the top and proceed according to the actually used view mode.
Click Target Cluster in the cluster list on the left to enter the cluster management page.
Find the target cluster in the cluster list and click the Cluster ID or Manage in the Operation column to enter the cluster management page.
3. On the cluster management page, select the Backup Management tab and click Roll Back.
4. On the database/table rollback page, set the rollback mode to By time point. Then, select the database/table to be rolled back, rename it, and click Roll Back.
Note:
Fast mode: Import full backup of the cluster, and then roll back the selected databases and tables. This rollback mode is slower than the other modes but has no limit.
Faster mode: Full backup + database-level binlog. For cross-database operation, if associated database is not selected at the same time, the database callback will fail.
Ultrafast mode: Full backup + table-level binlog. For cross-table operation, if associated table is not selected at the same time, the table rollback will fail.
5. In the pop-up window, confirm that everything is correct and click OK to initiate the rollback task.
6. After the task is submitted, you can click View Rollback Task or go to the task list to view the rollback progress and task details.
7. After the rollback is completed, you can see the new restored database/table in the original cluster and perform further operations.
Step 3. Compare the data
After the databases/tables are rolled back, you can log in to the cluster through DMC to compare and verify the data.
2. In the cluster list, find the rollback cluster and click Log In.
3. On the login page, enter the cluster account and password, and click Log In.
4. After entering the DMC management page, select the rollback database from the drop-down menu on the left and find the misoperation data. Then, verify that the data has been rolled back to its original status and other data is also consistent with how it was before the misoperation.
Was this page helpful?