Saturday 19 November 2011

Point-in-time Recovery in Oracle 10g RAC

point-in-time recovery till Nov 26th 2011 00:00:00

First:
Take a controlfile trace backup,

SQL> alter database backup controlfile to trace as '/tmp/control01.ctl';

1.shutdown immediate


2.olsnodes --> to check the number of nodes
 
3.crs_stat -t          -->to find status on both nodes running processes

Name Type Target State Host

------------------------------------------------------------
ora....X1.inst application ONLINE ONLINE sekiazu0140
ora....X2.inst application ONLINE ONLINE sekiazu0141
ora.Q0153X.db application ONLINE ONLINE sekiazu0140
ora....40.lsnr application ONLINE ONLINE sekiazu0140
ora....140.gsd application ONLINE ONLINE sekiazu0140
ora....140.ons application ONLINE ONLINE sekiazu0140
ora....140.vip application ONLINE ONLINE sekiazu0140
ora....41.lsnr application ONLINE ONLINE sekiazu0141
ora....141.gsd application ONLINE ONLINE sekiazu0141
ora....141.ons application ONLINE ONLINE sekiazu0141
ora....141.vip application ONLINE ONLINE sekiazu0141

4.srvctl stop database -d P0158X -->to stop the database in both nodes

5.srvctl stop nodeapps -n

6.srvctl stop nodeapps -n

7.removed all datafiles

8.startup nomount

rman target / catalog username/password@recoverycatalog;

9.restore the controlfile

RMAN>run {

              allocate channel t1 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/u001/app/TDP/P0158X/tdpo.opt)';
              restore controlfile to '/s106/oradata/control01.ctl' from 'P0158X_inc0_i2mq1hm6_1_1.rbck';
              }

RMAN> sql 'startup mount'


RMAN>run {

allocate channel t1 type 'SBT_TAPE';
SET UNTIL TIME "to_date('2011-10-26:00:00:00','YYYY-MM-DD:hh24:mi:ss')";
restore database;
recover database;
release channel t1;
}

11.checked the last archive sequence number with sequence number in alertlog 26th Nov 00:00:00 , it's matched.

12.sql>alter database open resetlogs;

13.srvctl start database -d P0158X -->to start the database in both nodes

14.srvctl start nodeapps -n

15.srvctl start nodeapps -n


*******************************************************************************************

Resetting RMAN to a Previous Incarnation:
The following scenario makes an old incarnation of database trgt current again:


# step 1: obtain the primary key of old incarnation
LIST INCARNATION OF DATABASE trgt;


List of Database Incarnations


DB Key Inc Key DB Name DB ID CUR Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 2 TRGT 1334358386 NO 154381 OCT 30 2001 16:02:12
1 116 TRGT 1334358386 YES 154877 OCT 30 2001 16:37:39

# step 2: start instance and reset database to incarnation key 2
STARTUP FORCE NOMOUNT;


RESET DATABASE TO INCARNATION 2;


# step 3: restore control file from previous incarnation, then shut down instance


# and mount control file
RESTORE CONTROLFILE;


STARTUP FORCE MOUNT;


# step 4: restore and recover the database to a point before the RESETLOGS
RESTORE DATABASE UNTIL SCN 154876;


RECOVER DATABASE UNTIL SCN 154876;


# step 5: make this incarnation the current incarnation and then list incarnations:
ALTER DATABASE OPEN RESETLOGS;


LIST INCARNATION OF DATABASE trgt;


List of Database Incarnations


DB Key Inc Key DB Name DB ID CUR Reset SCN Reset Time
------ ------- -------- ---------------- --- ---------- ----------
1 2 TRGT 1334358386 NO 154381 OCT 30 2001 16:02:12
1 116 TRGT 1334358386 NO 154877 OCT 30 2001 16:37:39
1 311 TRGT 1334358386 YES 154877 OCT 30 2001 17:17:03




Resetting the Database After Incomplete Recovery: Example
This example
assumes that an incomplete recovery or recovery with a backup control file was
performed in NOCATALOG mode. Later, RMAN is started in CATALOG mode, but the
RESYNC command fails because the incarnation has not been reset in the catalog.

% rman target / catalog rman/rman@catdb


Recovery Manager: Release 10.2.0.0.0 - Production
(c) Copyright 2001 Oracle Corporation. All rights reserved.

connected to target database: TRGT (DBID=1334531173)


connected to recovery catalog database


RMAN> RESYNC CATALOG;


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of resync command on default channel at 11/01/2001 12:00:43
RMAN-20003: target database incarnation not found in recovery catalog

RMAN> RESET DATABASE;
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete






No comments:

Post a Comment