Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
DROP TABLE operation is executed, the system automatically converts it to RENAME TABLE db.t TO __tdsql__recycle_bin__.<RECYCLED_TABLE> and moves the dropped table to __tdsql__recycle_bin__.RENAME TABLE __tdsql__recycle_bin__.<RECYCLED_TABLE> TO db.t, and restore the dropped table to the original database.DROP TABLE operations into RENAME TABLE operations, which are mutually exclusive with features that rely on binlog for data synchronization. Therefore, the recycle bin cannot be enabled in the following scenarios:tdsql> SET PERSIST tdsql_recycle_bin_enabled=1;
tdsql> SET PERSIST tdsql_recycle_bin_enabled=0;
tdsql_recycle_bin_enabled is a global variable.tdsql>SHOWRECYCLEBIN;
tdsql > SHOW RECYCLEBIN;+-----------+---------------+--------------+--------------------------------+---------------------+---------------------+| tindex_id | origin_schema | origin_table | recycle_table | drop_time | purge_time |+-----------+---------------+--------------+--------------------------------+---------------------+---------------------+| 53135 | sbtest | sbtest1_*** | bin$zxrh/bsnned9vygu4ioafg==$1 | 2026-01-14 16:19:54 | 2026-01-21 16:19:54 |+-----------+---------------+--------------+--------------------------------+---------------------+---------------------+1 row in set (0.01 sec)
Parameter | Description |
tindex_id | Table object ID. |
origin_schema | Original database name. |
origin_table | Original table name. |
recycle_table | Table names in the recycle bin. Description of naming rules: Since the recycle bin needs to centrally manage tables deleted from different databases, the system uses a specific encoding to ensure global uniqueness of table names. The encoding format is: bin$base64(md5(__ + tdsql_ + {db_name} + {table_name}))${version}, where ${version} is an incremental numeric tag used to distinguish multiple deletion records of the same table name. |
drop_time | Deletion time. |
purge_time | Automatic cleanup time (by default after 7 days). |
FLASHBACK TABLE $recycle_table_name TO BEFORE DROP [RENAME TO $new_table_name];
$recycle_table: the alias after the table enters the recycle bin.$new_table_name: the new name assigned when the table is restored.-- Recover the table and rename ittdsql> FLASHBACK TABLE `bin$zxrh/bsnned9vygu4ioafg==$1` TO BEFORE DROP RENAME TO sbtest11;
DROP TABLE $NAME PURGE;
PURGE RECYCLEBIN $recyele_table_name;
PURGE RECYCLEBIN;
Parameter | Type | Default Value | Description |
tdsql_recycle_bin_enabled | bool | 0 | Whether to enable the recycle bin. 0 (default value): disable. 1: enable |
tdsql_recycle_bin_max_size | ulong | 18446744073709551615 | Limit on the maximum number of objects in the recycle bin. |
tdsql_recycle_bin_drop_if_exceed_limit | ulong | 1 | Whether to DROP the table when the limit is exceeded. 0: No. 1 (default value): Yes. |
tdsql_recycle_bin_retention | ulong | 604800 | Retention period for objects in the recycle bin (in seconds). The default is 7 days. Tables exceeding this period will be automatically cleaned up. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan