Purpose
You can use this statement to purge database objects, such as tenants, databases, tables, and indexes, from the recycle bin.
Syntax
PURGE {TENANT | DATABASE | TABLE | INDEX} object_name;
object_name:
tenant_name
| database_name
| table_name
| index_name
Parameters
| Parameter | Description |
|---|---|
| tenant_name | The name of the tenant to be purged. You can use the original name of the tenant before it is dropped to the recycle bin or the name of the tenant in the recycle bin. The name of the tenant in the recycle bin is unique and can identify the tenant. The original name of the tenant may be repeated. If you use the original name of the tenant, the tenant entered the recycle bin at the earliest time is purged. |
| database_name | The name of the database to be purged from the recycle bin, which is the database name in the recycle bin. You cannot set this parameter to the original name of the database. |
| table_name | The name of the table to be purged from the recycle bin, which is the table name in the recycle bin. You cannot set this parameter to the original name of the table. |
| index_name | The name of the index to be purged from the recycle bin, which is the index name in the recycle bin. You cannot set this parameter to the original name of the index. |
Examples
Purge the
mysqltenant from the recycle bin.obclient> SHOW RECYCLEBIN; +--------------------------------+---------------+--------+----------------------------+ | OBJECT_NAME | ORIGINAL_NAME | TYPE | CREATETIME | +--------------------------------+---------------+--------+----------------------------+ | __recycle_$_1_1599722585571328 | mysql | TENANT | 2020-09-10 15:36:54.712101 | +--------------------------------+---------------+--------+----------------------------+ 1 row in set obclient> PURGE TENANT mysql; Query OK, 0 rows affected obclient> SHOW RECYCLEBIN; Empty setPurge the
__recycle_$_1_1597384386029184database from the recycle bin.obclient> CREATE DATABASE db1; Query OK, 1 row affected obclient> DROP DATABASE db1; Query OK, 0 rows affected obclient> SHOW RECYCLEBIN; +--------------------------------+---------------+----------+----------------------------+ | OBJECT_NAME | ORIGINAL_NAME | TYPE | CREATETIME | +--------------------------------+---------------+----------+----------------------------+ | __recycle_$_1_1597384386029184 | db1 | DATABASE | 2020-08-14 13:53:06.029367 | +--------------------------------+---------------+----------+----------------------------+ 1 row in set obclient> PURGE DATABASE __recycle_$_1_1597384386029184; Query OK, 0 rows affected obclient> SHOW RECYCLEBIN; Empty setPurge the
__recycle_$_1_1099511628776_1099511677778table from the recycle bin.obclient> CREATE TABLE test(c1 INT); Query OK, 0 rows affected obclient> DROP TABLE test; Query OK, 0 rows affected obclient> SHOW RECYCLEBIN; +-------------------------------------------+---------------+-------+----------------------------+ | OBJECT_NAME | ORIGINAL_NAME | TYPE | CREATETIME | +-------------------------------------------+---------------+-------+----------------------------+ | __recycle_$_1_1099511628776_1099511677778 | test | TABLE | 2017-10-20 17:40:22.304025 | +-------------------------------------------+---------------+-------+----------------------------+ 1 row in set obclient> PURGE TABLE __recycle_$_1_1099511628776_1099511677778; Query OK, 0 rows affected obclient> SHOW RECYCLEBIN; Empty setPurge the
__recycle_$_1_1597387726700872index from the recycle bin.obclient> CREATE TABLE t1(c1 INT); Query OK, 0 rows affected obclient> CREATE INDEX idx ON t1(c1); Query OK, 0 rows affected obclient> DROP TABLE t1; Query OK, 0 rows affected obclient> SHOW RECYCLEBIN; +--------------------------------+----------------------------+-------+----------------------------+ | OBJECT_NAME | ORIGINAL_NAME | TYPE | CREATETIME | +--------------------------------+----------------------------+-------+----------------------------+ | __recycle_$_1_1597387726700872 | __idx_1101710651081557_idx | INDEX | 2020-08-14 14:48:46.699145 | | __recycle_$_1_1597387726712976 | t1 | TABLE | 2020-08-14 14:48:46.712643 | +--------------------------------+----------------------------+-------+----------------------------+ 2 rows in set obclient> PURGE INDEX __recycle_$_1_1597387726700872; Query OK, 0 rows affected obclient> SHOW RECYCLEBIN; +--------------------------------+----------------------------+-------+----------------------------+ | OBJECT_NAME | ORIGINAL_NAME | TYPE | CREATETIME | +--------------------------------+----------------------------+-------+----------------------------+ | __recycle_$_1_1597387726700872 | __idx_1101710651081557_idx | INDEX | 2020-08-14 14:48:46.699145 | +--------------------------------+----------------------------+-------+----------------------------+ 1 rows in set