In case of incomplete recovery of the database it is always required to open the database using RESETLOGS option. But what if I fired the "Recover Database Until Cancel using Backup Controlfile" command on a database which just got aborted.
Below test explains that resetlogs is always required after firing recover database ....... using backup controlfile.
A running database is brought down using ABORT option.
SQL> shutdown abort
ORACLE instance shut down.
[oracle]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Thu Jul 30 15:51:28 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1620115456 bytes
Fixed Size 2226952 bytes
Variable Size 1241515256 bytes
Database Buffers 369098752 bytes
Redo Buffers 7274496 bytes
SQL> alter database mount;
Database altered.
Now I execute the command to recover using backup controlfile.
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 1926317955 generated at 07/30/2015 15:20:20 needed for thread 1
ORA-00289: suggestion :
/opt/oracle/product/11.2.0/dbhome_1/dbs/arch1_6153_864753447.dbf
ORA-00280: change 1926317955 for thread 1 is in sequence #6153
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
CANCEL
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/data/test01/system01.dbf'
ORA-01112: media recovery not started
I could have simply open the database and SMON would have done the crash recovery.
In order to try that I canceled the recovery as the required redolog is not yet archived. But while opening the database, I get the below error.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
So RESETLOGS is must to open the database now. So what should we do next? I checked the redo logs information and found that the log sequence to be applied is still not archived.
SQL> select sequence# from v$log;
SEQUENCE#
----------
6151
6153
6152
SQL> select member,group# from v$logfile where group#=(select group# from v$log where sequence#=6153);
MEMBER GROUP#
-------------------------------------------------------------------------------- -------------
/opt/oracle/data/test01/redo03.log 3
Simply pass the redolog file name while doing the recovery.
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 1926317955 generated at 07/30/2015 15:20:20 needed for thread 1
ORA-00289: suggestion :
/opt/oracle/product/11.2.0/dbhome_1/dbs/arch1_6153_864753447.dbf
ORA-00280: change 1926317955 for thread 1 is in sequence #6153
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/opt/oracle/data/dwh01/redo03.log
Log applied.
Media recovery complete.
Now open the database using resetlogs.
SQL> alter database open resetlogs;
Database altered.
Remember it is always mandatory to open the database using RESETLOGS option if the above RECOVER command is used.
Below test explains that resetlogs is always required after firing recover database ....... using backup controlfile.
A running database is brought down using ABORT option.
SQL> shutdown abort
ORACLE instance shut down.
[oracle]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Thu Jul 30 15:51:28 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1620115456 bytes
Fixed Size 2226952 bytes
Variable Size 1241515256 bytes
Database Buffers 369098752 bytes
Redo Buffers 7274496 bytes
SQL> alter database mount;
Database altered.
Now I execute the command to recover using backup controlfile.
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 1926317955 generated at 07/30/2015 15:20:20 needed for thread 1
ORA-00289: suggestion :
/opt/oracle/product/11.2.0/dbhome_1/dbs/arch1_6153_864753447.dbf
ORA-00280: change 1926317955 for thread 1 is in sequence #6153
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
CANCEL
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/data/test01/system01.dbf'
ORA-01112: media recovery not started
I could have simply open the database and SMON would have done the crash recovery.
In order to try that I canceled the recovery as the required redolog is not yet archived. But while opening the database, I get the below error.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
So RESETLOGS is must to open the database now. So what should we do next? I checked the redo logs information and found that the log sequence to be applied is still not archived.
SQL> select sequence# from v$log;
SEQUENCE#
----------
6151
6153
6152
SQL> select member,group# from v$logfile where group#=(select group# from v$log where sequence#=6153);
MEMBER GROUP#
-------------------------------------------------------------------------------- -------------
/opt/oracle/data/test01/redo03.log 3
Simply pass the redolog file name while doing the recovery.
SQL> recover database until cancel using backup controlfile;
ORA-00279: change 1926317955 generated at 07/30/2015 15:20:20 needed for thread 1
ORA-00289: suggestion :
/opt/oracle/product/11.2.0/dbhome_1/dbs/arch1_6153_864753447.dbf
ORA-00280: change 1926317955 for thread 1 is in sequence #6153
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/opt/oracle/data/dwh01/redo03.log
Log applied.
Media recovery complete.
Now open the database using resetlogs.
SQL> alter database open resetlogs;
Database altered.
Remember it is always mandatory to open the database using RESETLOGS option if the above RECOVER command is used.
Comments
Post a Comment