Monday, 11 May 2015

RMAN-06054 Media Recovery requesting unknown log

Recovery is a very complex Oracle topic. When a database is lost or damaged, beeing able to recover it is the top priority. A production database should always run on ARCHIVELOG mode and should have implemented a solid backup strategy.
But sometimes people run databases on NOARCHIVELOG mode, and implement cold backup strategies. Sometimes If you ever had this choice and you’re trying to recover your database with your RMAN cold backups , then one time or another you’ll hit error: RMAN-06054: Media Recovery requesting unknown log.
Take a look of the following example trying to recover a NOARCHIVELOG mode database with RMAN:

RMAN> recover database;
Starting recover at 11-SEP-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=1027 instance=neo devtype=DISK

starting media recovery
unable to find archive log
archive log thread=1 sequence=769
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 11/09/2010 14:25:14
RMAN-06054: media recovery requesting unknown log: thread 1 seq 769 lowscn 74863819

The cause of this RMAN-06054 error is because RMAN cannot find the online redo log files. In this case, Oracle database is running in NOARCHIVELOG mode and cannot perform complete recovery. So here we have 2 solutions:
SOLUTION 1:
The correct command to issue RMAN recovery in NOARCHIVELOG mode is:

RMAN> recover database noredo;
RMAN> alter database open resetlogs;

SOLUTION 2:
If the first solution fails we may issue fake recovery in SQL*PLUS as follows (but first ensure  you do not have the online redo log files)

SQL> recover database until cancel;
type cancel out immediately
SQL> alter database open resetlogs;

Change Oracle Flash Recovery Area Location

Oracle’s default Flash Recovery Area (FRA) location default location is at ORACLE_BASE/flash_recovery_area. Most of the times you want to take it from the default storage where you install oracle software to another storage device.

Flash Recovery Area feature allows you to set up a location on disk where your database can create/manage different kinds of backup and recovery files for you. Using a FRA eases the database administration by automatically naming recovery-related files, retaining them as long as they are needed for restore and recovery, and erase them when they are no longer needed to restore your database and/or space is needed for some backup and recovery purpose.
To move yours database FRA to a new location,  start SQLPlus to modify the DB_RECOVERY_FILE_DEST initialization parameter.

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='/u01/flash_recovery_area' SCOPE=BOTH SID='*';

-- or if you use ASM:
SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='+disk1' SCOPE=BOTH SID='*';

After you change this parameter, all new FRA files will be created in the new location.
The permanent files (control files and online redolog files), flashback logs and transient files can be left in the old FRA location. The database will delete the transient files from the old FRA location as they become eligible for deletion.
For FLASHBACK logfiles to be able to to pick up the new DB_RECOVERY_FILE_DEST location, the flashback option needs to be restarted like this:

SQL> shutdown immediate;
SQL> startup mount;
SQL> ALTER DATABASE FLASHBACK OFF;
SQL> ALTER DATABASE FLASHBACK ON;
SQL> ALTER DATABASE OPEN;