Friday, October 21, 2016

How to open without RESETLOGS after restore offline/cold backup


RESETLOGS | NORESETLOGS 

This clause determines whether Oracle Database resets the current log sequence number to 1, archives any unarchived logs (including the current log), and discards any redo information that was not applied during recovery, ensuring that it will never be applied. Oracle Database uses NORESETLOGS automatically except in the following specific situations, which require a setting for this clause: 

You must specify RESETLOGS: 

1.After performing incomplete media recovery or media recovery using a backup controlfile 
2.After a previous OPEN RESETLOGS operation that did not complete 
3.After a FLASHBACK DATABASE operation 

If a created controlfile is mounted, then you must specify RESETLOGS if the online logs are lost, or you must specify  NORESETLOGS if they are not lost. So, the point is that if we restored the controlfile backup, we have to do OPEN RESETLOGS because the controlfile type will be BACKUP controlfile. Moreover, online redo logs backups should also be available as RMAN doesn't backup online redo logs. 

In order to avoid RESETLOGS, the following steps can be followed: 

  • In addition to take cold backup of database, also take backup of online redo logs
  • Restore controlfile and database cold backup :
     RMAN> restore controlfile...... 
     RMAN> mount database ; 
     RMAN> restore database ; 
  • Copy the online redo logs to the desired location for new database.
  • Login to SQL*Plus and generate controlfile trace script ( please note that the database is mounted from rman after restoring controlfile ) :
     SQL> alter database backup controlfile to trace NORESETLOGS as '/tmp/ctl.sql' ; 
     SQL> SHUTDOWN IMMEDIATE 
  • Edit the controlfile if required. For example, to change the location of online redo logs copied.
  • Shutdown and STARTUP NOMOUNT the database and run the create controlfile script :
     SQL> STARTUP NOMOUNT 
     SQL> @/tmp/ctl.sql 
  •  Recover the database and open normal :
     SQL> RECOVER DATABASE ; 
     SQL> ALTER DATABASE OPEN ;

No comments:

Post a Comment