How to Restore Oracle Archive Redo Log Files from RMAN

RMAN: Restore Oracle Archive Redo Log Files
Андрей Волков

Андрей Волков

Системное, сетевое администрирование +DBA. И немного программист!))  Профиль автора.

RMAN will automatically restore any archived redo log files that it needs during a recovery process. You normally don’t need to restore archived redo log files manually. However, you may want to do so if any of the following situations apply:


  • You need to restore archived redo log files in anticipation of later performing a recovery; the idea is that if the archived redo log files are already restored, it will speed the recovery operation.
  • You’re required to restore the archived redo log files to a nondefault location, either because of media failure or because of storage space issues.
  • You need to restore specific archived redo log files in order to inspect them via LogMiner.

If you’ve enabled an FRA, then RMAN will, by default, restore archived redo log 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 archived redo log files.

If you restore archived redo log 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 archived redo log files that it determines are already on disk. Even if you specify a nondefault location, RMAN will not restore an archived redo log file to disk if the file already exists. In this situation, RMAN simply returns a message stating that the archived redo log 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.

Image Tip  Keep in mind that you can’t restore an archive redo log that you never backed up. Also, you can’t restore an archive redo log if the backup file containing the archive redo log is no longer available. Run the LIST ARCHIVELOG ALL command to view archive redo logs currently on disk, and LIST BACKUP OF ARCHIVELOG ALL to verify which archive redo log files are in available RMAN backups.

The following command will restore all archived redo log 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 archived redo log files from sequence 68:

RMAN> restore archivelog from sequence 68;

If you want to restore a range of archived redo log files, use the FROM SEQUENCE and UNTIL SEQUENCE clauses or the SEQUENCE BETWEEN clause, as shown. The following commands restore archived redo log 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 won’t restore an archived redo log 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;

Use the SET ARCHIVELOG DESTINATION clause if you want to restore archived redo log files to a location different from the default. The following example restores to the nondefault location /u01/archtemp. The option of the SET command must be executed from within an RMAN run{} block.

run{

set archivelog destination to '/u01/archtemp';

restore archivelog from sequence 8 force;

}

Вас заинтересует / Intresting for you:

RMAN: Specifying the Backup Us...
RMAN: Specifying the Backup Us... 2481 views Андрей Волков Sat, 29 Feb 2020, 10:14:03
RMAN: Using Online or Offline ...
RMAN: Using Online or Offline ... 1636 views Андрей Волков Sat, 29 Feb 2020, 10:01:33
How to use RMAN for Stop/Start...
How to use RMAN for Stop/Start... 1918 views Андрей Волков Mon, 31 Jan 2022, 17:35:05
RMAN: Adding RMAN Backup Infor...
RMAN: Adding RMAN Backup Infor... 816 views Андрей Волков Wed, 29 Sep 2021, 19:10:13
Comments (0)
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Suggested Locations