RESTORE
This statement is used to restore the data backed up by the BACKUP command to the specified database. This command is an asynchronous operation. After the submission is successful, you need to check the progress through the SHOW RESTORE command. Restoring tables of type OLAP is only supported.
grammar:
RESTORE SNAPSHOT [db_name].{snapshot_name} FROM `repository_name` [ON|EXCLUDE] ( `table_name` [PARTITION (`p1`, ...)] [AS `tbl_alias`], ... ) PROPERTIES ("key"="value", ...);
illustrate:
SHOW SNAPSHOT ON repo; statement.RESTORE SNAPSHOT example_db1.`snapshot_1` FROM `example_repo` ON ( `backup_tbl` ) PROPERTIES ( "backup_timestamp"="2018-05-04-16-45-08", "replication_num" = "1" );
RESTORE SNAPSHOT example_db1.`snapshot_2` FROM `example_repo` ON ( `backup_tbl` PARTITION (`p1`, `p2`), `backup_tbl2` AS `new_tbl` ) PROPERTIES ( "backup_timestamp"="2018-05-04-17-11-01" );
RESTORE SNAPSHOT example_db1.`snapshot_3` FROM `example_repo` EXCLUDE ( `backup_tbl` ) PROPERTIES ( "backup_timestamp"="2018-05-04-18-12-18" );
RESTORE
There can only be one ongoing recovery operation under the same database.
The table backed up in the warehouse can be restored and replaced with the existing table of the same name in the database, but the table structure of the two tables must be completely consistent. The table structure includes: table name, columns, partitions, materialized views, and so on.
When specifying a partial partition of the recovery table, the system will check whether the partition range can match.
Efficiency of recovery operations:
In the case of the same cluster size, the time-consuming of the restore operation is basically the same as the time-consuming of the backup operation. If you want to speed up the recovery operation, you can first restore only one copy by setting the replication_num parameter, and then adjust the number of copies by ALTER TABLE PROPERTY, complete the copy.