Saturday, August 27, 2011

Using _ALLOW_RESETLOGS_CORRUPTION in case of Archivelog unavailibility or corruption

Summary 
                Recently I had to recover my database using an old backup set for which I used the normal steps as under: 
1. startup the database at nomount state.
2. Connect to RMAN catalog
3. Run a script which allocates some tape channels, restore the controlfile, mount the database, restore database, recover applying the archives and redologs.
4. At the end I hade to open database with resetlogs;
STARTUP NOMOUNT;
rman TARGET / CATALOG rman/****@rman
RUN {
ALLOCATE CHANNEL c1 TYPE 'SBT_TAPE';
restore CONTROLFILE;
alter database mount;
restore database;
recover database;
release channel c1;
}
alter database open resetlogs;
exit;
While recovering the database you will be asked for some archives. A typical message like this occurs:
ORA-00279: change 9867098396261 generated at 08/21/2011 16:44 needed for
thread 1
ORA-00289: suggestion : /u01/oracle1/**********.arc
ORA-00280: change 9867098396261 for thread 1 is in sequence #****

Specify log: {=suggested | filename | AUTO | CANCEL}
CANCEL
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01195: online backup of file 10 needs more recovery to be consistent
ORA-01110: data file 10: �Archivelog location and name�
ORA-01112: media recovery not started
At the archivelogs apply step as you notice i pressed CANCEL

When i tried to open the database with resetlogs i got the error.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01195: online backup of file 10 needs more recovery to be consistent
ORA-01110: data file 10: �/oracle/oradata/MIS/data_01.dbf�
There is a hidden parameter _ALLOW_RESETLOGS_CORRUPTION=TRUE which will allow us to open database even though it�s not properly recovered.
ALTER SYSTEM SET "_allow_resetlogs_corruption"= TRUE SCOPE = SPFILE;
Tip: Also change the undo_management to “Manual”

After the two changes in the spfile you can open the database with:
sqlplus "/ as sysdba"
startup force

How to find all the corrupted objects in your Database
Partially restore database