RECOVER
Description
Recovers a database, table, or partition that was dropped by using the DROP command. The dropped database, table, or partition can be recovered within the period specified by the FE parameter catalog_trash_expire_second
(1 day by default).
Data deleted by using TRUNCATE TABLE cannot be recovered.
Syntax
-
Recover a database.
RECOVER DATABASE <db_name>
-
Recover a table.
RECOVER TABLE [<db_name>.]<table_name>
-
Recover a partition.
RECOVER PARTITION <partition_name> FROM [<db_name>.]<table_name>
Note:
- This command can only recover metadata deleted some time ago (1 day by default). You can change the duration by adjusting the FE parameter
catalog_trash_expire_second
. - If the metadata is deleted with identical metadata created, the previous one will not be recovered.
Examples
-
Recover database
example_db
.RECOVER DATABASE example_db;
-
Recover table
example_tbl
.RECOVER TABLE example_db.example_tbl;
-
Recover partition
p1
in theexample_tbl
table.RECOVER PARTITION p1 FROM example_tbl;