Parameter Name | Dynamic | Type | Default Value | Valid Values/Value Range | Description |
txsql_recycle_bin_enabled | yes | bool | OFF | ON/OFF | Enables or disables the Recycle Bin feature. |
txsql_recycle_bin_db_not_visible | yes | bool | ON | ON/OFF | Controls whether the __txsql_recycle_bin__ database is invisible to non-root Tencent users. |
txsql_recycle_scheduler_interval | yes | ulong | 0 | 0-18446744073709551615 | The time interval for automatic cleanup of the Recycle Bin. Unit: seconds. The default value is 0, indicating no automatic cleanup. |
txsql_recycle_bin_retention | yes | ulong | 604800 | 0-18446744073709551615 | 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). |
txsql_recycle_bin_max_size | yes | ulong | 18446744073709551615 | 0-18446744073709551615 | Sets the maximum capacity of the Recycle Bin. An error is reported when this capacity is exceeded. |
txsql_drop_if_exceed_recycle_limit | yes | bool | OFF | ON/OFF | Controls whether to delete tables directly when the Recycle Bin capacity is exceeded. If it is set to OFF, an error is directly reported without deleting tables when the maximum capacity of the Recycle Bin is exceeded. If it is set to ON, tables are directly deleted with a warning message displayed when the maximum capacity is exceeded. |
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 txsql_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?