Purpose
This statement is used to display the data backup sets (backup_set) and archive logs (archivelog_piece) required to restore to a specified time.
Limitations and considerations
You must execute the RESTORE PREVIEW command first and ensure it succeeds. Otherwise, you cannot obtain the required results.
Privilege requirements
The current user must have the ALTER SYSTEM privilege to execute this statement.
Syntax
SHOW RESTORE PREVIEW;
Examples
Specify the original data backup path and log archive path, and set the desired restore timestamp to
2024-04-09 16:15:54.ALTER SYSTEM RESTORE FROM 'file:///ob_backup/data, file:///ob_backup/archive' UNTIL TIME = '2024-04-09 16:15:54' PREVIEW;Displays the required
backup_setandarchivelog_piecefor restoring to a specified time.SHOW RESTORE PREVIEW;The return result is as follows:
+--------------+-----------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | backup_type | backup_id | backup_dest | description | +--------------+-----------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------+ | BACKUP_SET | 1 | file:///ob_backup/data/backup_set_1_full | | | BACKUP_PIECE | 1 | file:///ob_backup/archive/piece_d1002r1p1 | start_scn_display: 20240409T155954, checkpoint_scn_display: 20240409T160154. | | BACKUP_PIECE | 2 | file:///ob_backup/archive/piece_d1002r1p2 | start_scn_display: 20240409T160154, checkpoint_scn_display: 20240409T160353. | | BACKUP_PIECE | 3 | file:///ob_backup/archive/piece_d1002r1p3 | start_scn_display: 20240409T160354, checkpoint_scn_display: 20240409T160553. | | BACKUP_PIECE | 4 | file:///ob_backup/archive/piece_d1002r1p4 | start_scn_display: 20240409T160554, checkpoint_scn_display: 20240409T160754. | | BACKUP_PIECE | 5 | file:///ob_backup/archive/piece_d1002r1p5 | start_scn_display: 20240409T160754, checkpoint_scn_display: 20240409T160953. | | BACKUP_PIECE | 6 | file:///ob_backup/archive/piece_d1002r1p6 | start_scn_display: 20240409T160954, checkpoint_scn_display: 20240409T161154. | | BACKUP_PIECE | 7 | file:///ob_backup/archive/piece_d1002r1p7 | start_scn_display: 20240409T161154, checkpoint_scn_display: 20240409T161354. | | BACKUP_PIECE | 8 | file:///ob_backup/archive/piece_d1002r1p8 | start_scn_display: 20240409T161354, checkpoint_scn_display: 20240409T161554. | +--------------+-----------+--------------------------------------------------------------------------------+------------------------------------------------------------------------------+ 9 rows in setThe query results display all the backupSets and archiveLogPieces required to restore to the specified time, along with their storage paths at the original data backup and log archive destinations. If, due to business needs, you have manually moved some or all of these files to other locations or storage media, you will need to maintain the mapping between the original paths and the current paths for each backupSet and archiveLogPiece based on your actual situation.
For example, in the query result above, you need to restore the archivelog_piece with
BACKUP_PIECEset to1, but this file has already been manually moved tos3://test_bucket/archive/piece_1. Therefore, when using theADD RESTORE SOURCEcommand to load the backup path, you need to specify the new storage paths3://test_bucket/archive/piece_1.