This topic describes the table recycle bin.
Background information
The table recycle bin feature in PolarDB-X 1.0 allows you to restore the tables that you remove by accident.
After you enable the table recycle bin feature in PolarDB-X 1.0, tables that are removed by executing the DROP TABLE statement are moved to the table recycle bin and are no longer visible. Two hours after the tables are moved to the table recycle bin, they are automatically deleted and cannot be restored. You can view, restore, and clear the tables in the table recycle bin.
Limits
This feature is supported on an instance of PolarDB-X 1.0 5.3.3-1670435 or later.
By default, the table recycle bin feature is disabled in PolarDB-X 1.0. For more information about how to enable the feature, see Enable the table recycle bin feature.
In PolarDB-X 1.0, the tables that are removed by executing the
TRUNCATE TABLEstatement are not moved to the table recycle bin.Tables in the recycle bin still occupy the storage space before they are automatically cleared. To release the storage space as soon as possible, you can access the recycle bin to manually delete them.
PolarDB-X 1.0 allows you to manage the table recycle bin by using the command line.
After you enable the table recycle bin feature, if the error message "
cant find file" is returned when you execute theDROP TABLEstatement, you must disable the recycle bin feature and then execute theDROP TABLEstatement again.
Enable the table recycle bin
Log on to the PolarDB-X console and select the region where the instance is deployed.
On the Instances page, click the instance name.
In the left-side navigation pane, click Table Recycle Bin.
Select the database for which you want to enable the table recycle bin and click Enable.
In the message that appears, click OK.
Restore tables
Go to the Table Recycle Bin page, find the database to view the list of tables in the table recycle bin.
Find the table and click Restore.
Delete tables
Go to the Table Recycle Bin page, find the database to view the list of tables in the table recycle bin.
Find the table and click Delete. To clear all tables in the recycle bin, click Clear Recycle Bin.
Disable the table recycle bin feature
Go to the Table Recycle Bin page and find the database.
Click Disable.