Restoring Data of Multiple Deleted Databases
Scenarios
If a large amount of database and table data is lost due to a misoperation and this event has a wide impact, the entire instance must be restored.
If you can identify when the misoperation was performed, restore the instance to that point in time to restore the data. Otherwise, restore the entire instance using backups.
Operation Process
| Procedure | Description |
|---|---|
| Create databases on the console. | |
| Create tables and insert data using DAS. | |
| Delete the databases on the console. | |
| Restore the deleted database data from backups. | |
| Log in to the DAS and check whether the data is restored. |
Step 1: Create Databases
- Log in to the console.
- Click
in the upper left corner and select a region and project. - Click
in the upper left corner of the page and choose Databases > TaurusDB. - On the Instances page, click the instance name.
- In the navigation pane, choose Databases.
- Click Create Database. In the displayed dialog box, enter the database name principles and click OK. Then repeat this process to create another database named design_patterns.
Step 2: Create Tables and Insert Data
- Log in to the console.
- Click
in the upper left corner and select a region and project. - Click
in the upper left corner of the page and choose Databases > TaurusDB. - On the Instances page, locate the instance and click Log In in the Operation column.
Alternatively, click the instance name on the Instances page. On the displayed Basic Information page, click Log In in the upper right corner.
- Enter the database username and password and click Test Connection. After the connection test is successful, click Log In.
- On the top menu bar, choose SQL Operations > SQL Query.
- Run the following SQL statements to create tables and insert data into them:
- Create a table and insert data in database principles.
- Creating a table
CREATE TABLE `solid_principle` ( `abbr` varchar(32) COLLATE utf8mb4_general_ci NOT NULL, `name_en` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, `name_cn` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`abbr`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
- Inserting data
insert into solid_principle (abbr,name_en,name_cn) VALUES ('S','Single Responsibility Principle','Single Responsibility Principle'),('O','Open Close Principle','Open Close Principle'),('L','Liskov Substitution Principle','Liskov Substitution Principle'),('I','Interface Segregation Principle','Interface Segregation Principle'),('D','Dependency Inversion Principle','Dependency Inversion Principle');
- Creating a table
- Create a table and insert data in database design_patterns.
- Creating a table
CREATE TABLE `creational_pattern` ( `id` int unsigned NOT NULL, `name` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `structural_pattern` ( `id` int unsigned NOT NULL, `name` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `behavioral_pattern` ( `id` int unsigned NOT NULL, `name` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
- Inserting data
insert into creational_pattern (id,name) VALUES (1001,'Singleton pattern'),(1002,'Abstract Factory'),(1003,'Builder Pattern'),(1004,'Factory Method pattern'),(1005,'Prototype pattern');
insert into structural_pattern (id,name) VALUES (2001,'Adapter pattern'),(2002,'Bridge pattern'),(2003,'Decorator pattern'),(2004,'Composite pattern'),(2005,'Facade pattern'),(2006,'Flyweight pattern'),(2007,'Proxy pattern');
insert into behavioral_pattern (id,name) VALUES (3001,'Template method pattern'),(3002,'Command pattern'),(3003,'Iterator pattern'),(3004,'Observer pattern'),(3005,'Mediator pattern'),(3006,'Memento pattern'),(3007,'Interpreter pattern'),(3008,'State pattern'),(3009,'Strategy pattern'),(3010,'Chain-of-responsibility pattern'),(3011,'Visitor pattern');
- Creating a table
- Create a table and insert data in database principles.
Step 3: Delete the Databases
- Log in to the console.
- Click
in the upper left corner and select a region and project. - Click
in the upper left corner of the page and choose Databases > TaurusDB. - On the Instances page, click the instance name.
- In the navigation pane, choose Databases.
- On the displayed page, locate databases principles and design_patterns, respectively, and click Delete in the Operation column.
- In the displayed dialog box, enter DELETE as prompted and click OK.
Step 4: Restore Database Data
If you can identify which database is deleted by mistake, restore its tables to a point in time. Otherwise, restore the instance to a point in time.
- Log in to the console.
- Click
in the upper left corner and select a region and project. - Click
in the upper left corner of the page and choose Databases > TaurusDB. - On the Instances page, click the target instance name.
- In the navigation pane, choose Backups. On the Full Backups tab page, choose More > Restore Table above the backup list.
- On the displayed page, set the restoration date, time range, time point, and tables to be restored.
- After the restoration is complete, new tables with timestamps appended as suffixes to original table names are generated in the instance. You can rename the new tables, but the table names must be unique.
- Time-specific table: The tables to be restored are read from the latest full backup before the selected time point. Recent table: The tables to be restored are read from the selected time point.
- Tables created after the latest full backup are not displayed in the time-specific table list. You can select Recent table to view the latest table details.
- If the tables to be restored are not found or are deleted by mistake, you need to log in to the database and create tables with the same names. Then, the tables to be restored will be displayed when you select Recent table.
- Click Next: Confirm. On the displayed page, confirm the information about the tables to be restored and click Restore Now.
- On the Instances page, view the instance status, which is Restoring. During the restoration, workloads are not interrupted.
You can also view the progress and result on the Task Center page.
- Log in to the console.
- Click
in the upper left corner and select a region and project. - Click
in the upper left corner of the page and choose Databases > TaurusDB. - On the Instances page, click the target instance name.
- In the navigation pane, choose Backups. On the displayed page, click Restore to Point in Time.
- Select the restoration date and time range, enter a time point within the selected time range, and set Restoration Method to Restore to Original.
- Select the confirmation check box and click Next.
- Confirm the task details and click OK.
Data on the original instance will be overwritten. The original instance will be unavailable during the restoration, so restore data during off-peak hours.
- Check the restoration results.
When the instance status changes from Restoring to Available, the restoration is complete.
Step 5: Check the Restoration Results
- Log in to the console.
- Click
in the upper left corner and select a region and project. - Click
in the upper left corner of the page and choose Databases > TaurusDB. - On the Instances page, click the instance name.
- In the navigation pane, choose Databases. Check that the deleted database is displayed in the database list.
- Return to the instance list and click Log In in the Operation column of the target instance.
- In the displayed dialog box, enter the password and click Test Connection.
- After the connection test is successful, click Log In.
- Check the database name and table data to verify if the restoration is complete.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot