Recover from Recycle Bin
Data Lifecycleβ
When a user executes the DROP DATABASE/TABLE/PARTITION
command without FORCE
, Doris moves the deleted database, table, or partition to the recycle bin. The RECOVER
command can be used to restore all data of the deleted database, table, or partition from the recycle bin, making them visible again.
Recover from Recycle Binβ
In order to avoid disasters caused by misoperation, Doris supports data recovery of accidentally deleted databases, tables, and partitions. After dropping a table or database, Doris does not physically delete the data immediately. Instead, it is moved to the trash for a certain period of time (the default is 1 day, which can be configured through the catalog_trash_expire_second
parameter in fe.conf
). The administrator can use the RECOVER
command to restore accidentally deleted data.
Note: If the deletion was performed using DROP FORCE
, the data will be immediately deleted and cannot be recovered.
Query Recycle Binβ
You can query the Recycle Bin with the following command:
SHOW CATALOG RECYCLE BIN [WHERE NAME [= "name" | LIKE "name_matcher"]];
For more detailed syntax and best practices, please refer to the SHOW-CATALOG-RECYCLE-BIN command manual, You can also type help SHOW CATALOG RECYCLE BIN
on the MySql client command line for more help.
Start Data Recoveryβ
To recover deleted data, you can use the following commands:
- Recover the database named
example_db
:
RECOVER DATABASE example_db;
- Recover the table named
example_tbl
:
RECOVER TABLE example_db.example_tbl;
- Recover partition named p1 in table example_tbl:
RECOVER PARTITION p1 FROM example_tbl;
For more detailed syntax and best practices used by RECOVER, please refer to the RECOVER command manual, You can also type HELP RECOVER
on the MySql client command line for more help.