Monday, May 3, 2010

Recovery using RMAN through a RESETLOGS

I had to recover a database after a RESETLOGS a while ago and recently found the doco. This is the syntax. I may edit it to include comments later, but I think the commands should be self-explanatory.

rman catalog rman/xxxxx@rmancat

connect target

RMAN> run {
2> allocate channel ch1 type 'SBT_TAPE';
3> set until time "to_date('13-JUL-2009 21:00:00','dd-MON-YYYY hh24:mi:ss')";
4> restore database;
5> sql 'alter database mount';
6> recover database;
7> alter database open resetlogs;
8> }

allocated channel: ch1
channel ch1: sid=1095 devtype=SBT_TAPE
channel ch1: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

executing command: SET until clause
released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of set command at 07/24/2009 11:08:38
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time

RMAN> list incarnation of database;


List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
3794137 3794138 DEVDB 1020948257       PARENT  1          19-JUN-09
3794137 3869825 DEVDB 1020948257       CURRENT 8615505    23-JUL-09

RMAN> set dbid 1020948257;

executing command: SET DBID
database name is "DEVDB" and DBID is 1020948257

RMAN> reset database to incarnation 3794138;

database reset to incarnation 3794138

RMAN> run {
2> allocate channel ch1 type 'SBT_TAPE';
3> set until time "to_date('13-JUL-2009 21:00:00','dd-MON-YYYY hh24:mi:ss')";
4> restore database;
5> sql 'alter database mount';
6> recover database;
7> alter database open resetlogs;
8> }

allocated channel: ch1
channel ch1: sid=1095 devtype=SBT_TAPE
channel ch1: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

executing command: SET until clause

Starting restore at 24-JUL-09

channel ch1: starting datafile backupset restore
channel ch1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u08/oradata/DEVDB/system.dbf
restoring datafile 00002 to /u08/oradata/DEVDB/undotbs_1.dbf
restoring datafile 00003 to /u08/oradata/DEVDB/sysaux_01.dbf
restoring datafile 00004 to /u09/oradata/DEVDB/data_l_01.dbf
restoring datafile 00005 to /u09/oradata/DEVDB/data_m_01.dbf
restoring datafile 00006 to /u09/oradata/DEVDB/data_s_01.dbf
restoring datafile 00007 to /u10/oradata/DEVDB/indx_l_01.dbf
restoring datafile 00008 to /u10/oradata/DEVDB/indx_m_01.dbf
restoring datafile 00009 to /u10/oradata/DEVDB/indx_s_01.dbf
channel ch1: reading from backup piece DEVDB_db_13_07_2009_18_51_t692131889_s4_p1
channel ch1: restored backup piece 1
piece handle=DEVDB_db_13_07_2009_18_51_t692131889_s4_p1 tag=TAG20090713T185129
channel ch1: restore complete, elapsed time: 00:04:06
Finished restore at 24-JUL-09

sql statement: alter database mount
released channel: ch1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 07/24/2009 11:16:05
RMAN-11003: failure during parse/execution of SQL statement: alter database mount
ORA-00205: error in identifying control file, check alert log for more info

RMAN> run {
2> allocate channel ch1 type 'SBT_TAPE';
3> set until time "to_date('13-JUL-2009 21:00:00','dd-MON-YYYY hh24:mi:ss')";
4> restore controlfile;
5> restore database;
6> sql 'alter database mount';
7> recover database;
8> alter database open resetlogs;
9> }

allocated channel: ch1
channel ch1: sid=1095 devtype=SBT_TAPE
channel ch1: Veritas NetBackup for Oracle - Release 6.5 (2007072323)

executing command: SET until clause

Starting restore at 24-JUL-09

channel ch1: starting datafile backupset restore
channel ch1: restoring control file
channel ch1: reading from backup piece DEVDB_db_13_07_2009_18_51_t692132525_s5_p1
channel ch1: restored backup piece 1
piece handle=DEVDB_db_13_07_2009_18_51_t692132525_s5_p1 tag=TAG20090713T185129
channel ch1: restore complete, elapsed time: 00:00:37
output filename=/u08/oradata/DEVDB/control01.ctl
output filename=/u09/oradata/DEVDB/control02.ctl
output filename=/u10/oradata/DEVDB/control03.ctl
Finished restore at 24-JUL-09

Starting restore at 24-JUL-09

skipping datafile 1; already restored to file /u08/oradata/DEVDB/system.dbf
skipping datafile 2; already restored to file /u08/oradata/DEVDB/undotbs_1.dbf
skipping datafile 3; already restored to file /u08/oradata/DEVDB/sysaux_01.dbf
skipping datafile 4; already restored to file /u09/oradata/DEVDB/data_l_01.dbf
skipping datafile 5; already restored to file /u09/oradata/DEVDB/data_m_01.dbf
skipping datafile 6; already restored to file /u09/oradata/DEVDB/data_s_01.dbf
skipping datafile 7; already restored to file /u10/oradata/DEVDB/indx_l_01.dbf
skipping datafile 8; already restored to file /u10/oradata/DEVDB/indx_m_01.dbf
skipping datafile 9; already restored to file /u10/oradata/DEVDB/indx_s_01.dbf
Finished restore at 24-JUL-09

sql statement: alter database mount

Starting recover at 24-JUL-09

starting media recovery

channel ch1: starting archive log restore to default destination
channel ch1: restoring archive log
archive log thread=1 sequence=712
channel ch1: restoring archive log
archive log thread=1 sequence=713
channel ch1: reading from backup piece DEVDB_arch__t692132627_s6_p1
channel ch1: restored backup piece 1
piece handle=DEVDB_arch__t692132627_s6_p1 tag=TAG20090713T190347
channel ch1: restore complete, elapsed time: 00:00:35
archive log filename=/u01/app/oracle/product/10.2.0/db_1/dbs/archDEVDB_arch712_1_689964513.arc thread=1 sequence=712
archive log filename=/u01/app/oracle/product/10.2.0/db_1/dbs/archDEVDB_arch713_1_689964513.arc thread=1 sequence=713
channel ch1: starting archive log restore to default destination
channel ch1: restoring archive log
archive log thread=1 sequence=714
channel ch1: reading from backup piece DEVDB_arch__t692139952_s9_p1
channel ch1: restored backup piece 1
piece handle=DEVDB_arch__t692139952_s9_p1 tag=TAG20090713T210552
channel ch1: restore complete, elapsed time: 00:00:36
archive log filename=/u01/app/oracle/product/10.2.0/db_1/dbs/archDEVDB_arch714_1_689964513.arc thread=1 sequence=714
media recovery complete, elapsed time: 00:00:00
Finished recover at 24-JUL-09

database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
released channel: ch1

No comments:

Post a Comment