Updated on 2026-07-09 GMT+08:00

Restoring Data of Deleted Tables

Scenarios

In database administration, accidental deletion of a database is a high-risk scenario that can lead to data loss. DDL operations, such as DROP DATABASE or TRUNCATE TABLE, directly remove physical data objects. These operations are irreversible, which means that data recovery depends entirely on full physical backups and incremental log. For large datasets, relying on traditional backup and restoration mechanisms may take hours.

To mitigate this, this section provides two restoration methods:

  • If you can identify the deleted tables and the deletion time, you can perform table-level point-in-time recovery (PITR).
  • If database/table recycle bin is enabled, TaurusDB moves deleted tables into a __recyclebin__ database for temporary storage. You can customize the maximum retention period for these deleted tables. Before this retention threshold expires, you can execute a stored procedure to rapidly recover the databases or tables from the recycle bin.

Operation Process

Procedure

Description

Step 1: Create a Database

Create a database on the console.

Step 2: Create a Table and Insert Data

Create a table and insert data using DAS.

Step 3: Delete Table Data

Log in to DAS and delete the tables.

Table-level PITR

Restore the deleted table data using table-level PITR.

Step 5: Check the Restoration Results

Log in to the DAS and check whether the data is restored.

Precautions

Data on the original instance will be overwritten. The original instance will be unavailable during the restoration, so restore data during off-peak hours.

Step 1: Create a Database

  1. Log in to the TaurusDB console.
  2. Click in the upper left corner and select a region and project.
  3. On the Instances page, click the target instance name.
  4. In the navigation pane, choose Databases.
  5. Click Create Database. In the displayed dialog box, enter the database name principles and click OK.

Step 2: Create a Table and Insert Data

  1. Log in to the TaurusDB console.
  2. Click in the upper left corner and select a region and project.
  3. 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. The DAS login page is displayed.

  4. Enter the database username and password and click Test Connection.
  5. After the connection test is successful, click Log In. Then you can access and manage your databases.
  6. On the top menu bar, choose SQL Operations > SQL Query.
  7. Run the following SQL statements to create a table and insert data into it:

    Create a table and insert data in the database principles.
    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;
    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');

Step 3: Delete Table Data

  1. Log in to the TaurusDB console.
  2. Click in the upper left corner and select a region and project.
  3. 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. The DAS login page is displayed.

  4. Enter the database username and password and click Test Connection.
  5. After the connection test is successful, click Log In. Then you can access and manage your databases.
  6. On the top menu bar, choose SQL Operations > SQL Query.
  7. Select database principles and run the following SQL statement to delete table data.

    delete from `solid_principle`;

Step 4: Restore Table Data

  1. Log in to the TaurusDB console.
  2. Click in the upper left corner and select a region and project.
  3. On the Instances page, click the target instance name.
  4. In the navigation pane, choose Backups. On the Full Backups tab page, click Restore Table.
  5. 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 they are deleted by mistake, you need to log in to the database and create tables with the same names. Then, these tables will be displayed when you select Recent table.

  6. Click Next: Confirm. On the displayed page, confirm the information about the tables to be restored and click Restore Now.
  7. 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.

  1. Log in to the TaurusDB console.
  2. Click in the upper left corner and select a region and project.
  3. On the Instances page, locate the target 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. The DAS login page is displayed.

  4. Enter the database username and password and click Test Connection.
  5. After the connection test is successful, click Log In. Then you can access and manage your databases.
  6. On the top menu bar, choose SQL Operations > SQL Query.
  7. Run the following SQL statement to query the tables temporarily stored in the recycle bin:

    CALL dbms_recyclebin.show_tables();

  8. Run the following SQL statement to restore the solid_principle table to the original database principles:

    Syntax:

    call dbms_recyclebin.restore_table('TABLE_NAME');

    TABLE_NAME: the name of the table after it is moved to the recycle bin

    Example:

    CALL dbms_recyclebin.restore_table('principles@solid_principle@69fd4d8f');

Step 5: Check the Restoration Results

  1. Log in to the TaurusDB console.
  2. Click in the upper left corner and select a region and project.
  3. On the Instances page, locate the instance and click Log In in the Operation column.
  4. In the displayed dialog box, enter the password and click Test Connection.
  5. After the connection test is successful, click Log In.
  6. Check the table data of the database to verify if the restoration is complete.