Parameter Name | Dynamic | Type | Default Value | Valid Values/Value Range | Description |
cdb_recycle_bin_enabled | yes | bool | OFF | ON/OFF | Enables or disables the Recycle Bin feature. |
cdb_recycle_bin_retention | yes | ulong | 604800 | 0-4294966272 | Determines how long a table remains in the Recycle Bin before it is automatically cleaned up. Unit: seconds. The default value is 604800 seconds (one week). |
cdb_recycle_scheduler_interval | yes | ulong | 0 | 0-4294966272 | The time interval for automatic cleanup of the Recycle Bin. Unit: seconds. The default value is 0, indicating no automatic cleanup. |
clear <TABLE_NAME> from recycle_bin;Orcall sys.recycle_bin_purge_table('<RECYCLE_NAME>');
CREATE TABLE IF NOT EXISTS recycle_bin_info (table_name varchar(64) NOT NULL, -- The name of the table after being recycled in the Recycle Binorigin_schema VARCHAR(64) NOT NULL, -- The database where the table was located before being recycledorigin_table VARCHAR(64) NOT NULL, -- The name of the table before being recycleddrop_time timestamp NOT NULL, -- The time when the table was droppedpurge_time timestamp NOT NULL, -- The time when the table will be cleaned upPRIMARY KEY(table_name),KEY(purge_time),KEY `idx_drop_time` (`drop_time`),KEY `idx_schema_table` (`origin_schema`,`origin_table`)) ENGINE=INNODB CHARACTER SET latin1 STATS_PERSISTENT=0 ROW_FORMAT=DYNAMIC TABLESPACE=mysql
set global cdb_recycle_bin_enabled=on;
with the root account to enable the Recycle Bin feature.show recycle_bin;
or select mysql.recycle_bin_info;
to view information about all tables recycled in the Recycle Bin.restore db.table from recycle_bin;
is used to restore a specified table from the Recycle Bin. If there are multiple tables with the same name, the most recently deleted one is restored.restore db.table from recycle_bin with {timestamp('expr')} {recycle_name $recycle_name};
is used to restore a table with a specified name and deletion time from the Recycle Bin if a timestamp is specified. If recycle_name is specified, a table is found with the unique recycle_name instead of the preceding db and table and then restored as db.table. Therefore, this command can be used to restore a table to another schema or modify the name of a restored table.restore database db_name from recycle_bin;
is used to restore all tables in a specified database. If there are tables with the same name, an error is reported.clear recycle_bin;
is used to clear the entire Recycle Bin.clear recycle_bin {all} {db.table} {before timestamp $time};
is used to clear a table with a specified name or tables deleted before a specified time. If there are multiple tables with the specified name, the oldest one is deleted. If all is specified, all tables with the same name are deleted.show recycle_bin;
is used to display information about the Recycle Bin.drop ... without recycle_bin;
is used to force delete a table rather than placing it into the Recycle Bin.
Was this page helpful?