PolarDB-X支持表回收站功能,详情情参见表回收站,本文档将介绍如何通过命令行管理表回收站。
强制删除表
通过在 DROP 语句末添加 PURGE 参数强制删除表,不放入回收站
DROP TABLE table-name PURGE
展示回收站
SHOW recyclebin
mysql> show recyclebin;
+------+--------------------------+---------------+---------------------+
| ID | NAME | ORIGINAL_NAME | CREATED |
+------+--------------------------+---------------+---------------------+
| 0 | BIN_2FGVWOE1F8JDYTR0EKIQ | rb1 | 2018-07-05 10:23:17 |
+------+--------------------------+---------------+---------------------+
1 row in set (0.01 sec)
恢复表
FLASHBACK TABLE bin-name TO BEFORE DROP [RENAME TO new-name]
mysql> flashback table BIN_2FGVWOE1F8JDYTR0EKIQ to before drop;
Query OK, 0 rows affected (0.14 sec)
清理表
PURGE TABLE bin-name
mysql> purge table BIN_2B0KUPYRZJ6C1UV4BBYF;
Query OK, 0 rows affected (0.13 sec)
清空回收站
PURGE recyclebin