RMAN will automatically restore any archivelog files that it needs during a recovery process. You normally do not need to restore archivelog files manually. However, you may want to do so if any of the following situations apply:
• You need to restore archivelog files in anticipation of later performing a recovery; the idea is that if the archivelog files are already restored, it will speed the recovery operation.
• You are required to restore the archivelog files to a nondefault location, either because of media failure or because of storage space issues.
• You need to restore specific archivelog files to inspect them via LogMiner.
If you have enabled an FRA, then RMAN will, by default, restore archivelog files to the destination defined by the initialization parameter DB_RECOVERY_FILE_
DEST. Otherwise, RMAN uses the LOG_ARCHIVE_DEST_N initialization parameter (where N is usually 1) to determine where to restore the archivelog files.
If you restore archivelog files to a nondefault location, RMAN knows the location they were restored to and automatically finds these files when you issue any subsequent RECOVER commands. RMAN will not restore archivelog files that it determines are already on disk. Even if you specify a nondefault location, RMAN will not restore an archivelog file to disk if the file already exists. In this situation, RMAN simply returns a message stating that the archivelog file has already been restored. Use the FORCE option to override this behavior.
If you are uncertain of the sequence numbers to use during a restore of log files, you can query the V$LOG_HISTORY view.
Keep in mind that you cannot restore an archivelog that you never backed up. Also, you cannot restore an archivelog if the backup file containing the archivelog is no longer available. Run the LIST ARCHIVELOG ALL command to view archivelogs currently on disk, and run LIST BACKUP OF ARCHIVELOG ALL to verify which archivelog files are in available RMAN backups.
Restoring to the Default Location
The following command will restore all archivelog files that RMAN has backed up:
RMAN> restore archivelog all;
If you want to restore from a specified sequence, use the FROM SEQUENCE clause. You may want to run this query first to establish the most recent log files and sequence numbers that have been generated:
SQL> select sequence#, first_time from v$log_history order by 2;
This example restores all archivelog files from sequence 68:
RMAN> restore archivelog from sequence 68;
If you want to restore a range of archivelog files, use the FROM SEQUENCE and UNTIL SEQUENCE clauses or the SEQUENCE BETWEEN clause, as shown. The following commands restore archivelog files from sequence 68 through sequence 78, using thread 1:
RMAN> restore archivelog from sequence 68 until sequence 78 thread 1; RMAN> restore archivelog sequence between 68 and 78 thread 1;
By default, RMAN will not restore an archivelog file if it is already on disk. You can override this behavior if you use the FORCE, like so:
RMAN> restore archivelog from sequence 1 force;