Tuesday, February 24, 2009

How to take RMAN Backup from BCV copy of the Database:

How to take RMAN Backup from BCV copy of the Database:


1.
a.
DB Release info of target DB, catalog DB, BCV copy DB:
a) 10.2.0.4 - ASM storage
b) 10.2.0.4
c) 10.2.0.4 - ASM storage

b..
OS Release info of Primary and BCV:
a) Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
b) Red Hat Enterprise Linux AS release 4 (Nahant Update 4)


2. Please verify fhrba_seq column values, should match between Primary and BCV copy:

-- On Primary
set linesize 120;
select hxfil FILE#,fhsta STAT,fhscn SCN, fhthr thr, fhrba_Seq SEQUENCE,fhtnm TABLESPACE
from x$kcvfh
order by 1;

-- On BCV
set linesize 120;
select hxfil FILE#,fhsta STAT,fhscn SCN, fhthr thr, fhrba_Seq SEQUENCE,fhtnm TABLESPACE
from x$kcvfh
order by 1;

Note: bug 6004226 may show different fhrba_seq column values between Primary and BCV copy.
Workaround is in step 4.

3.
Error:

RMAN> resync catalog;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of resync command on default channel at 12/10/2008 07:45:32
ORA-00236: snapshot operation disallowed: mounted control file is a backup

RMAN> shutdown immediate

database dismounted
Oracle instance shut down

RMAN> run {
2> startup mount;
3> allocate channel edw_backup_sbt1 type sbt format '%d_full_backup_%U' parms 'ENV=(NB_ORA_POLICY=BCV_ASM,NB_ORA_SCHED=FULL_BCV)' maxpiecesize 8 G;
4> allocate channel edw_backup_sbt2 type sbt format '%d_full_backup_%U' parms 'ENV=(NB_ORA_POLICY=BCV_ASM,NB_ORA_SCHED=FULL_BCV)' maxpiecesize 8 G;
5> allocate channel edw_backup_sbt3 type sbt format '%d_full_backup_%U' parms 'ENV=(NB_ORA_POLICY=BCV_ASM,NB_ORA_SCHED=FULL_BCV)' maxpiecesize 8 G;
6> allocate channel edw_backup_sbt4 type sbt format '%d_full_backup_%U' parms 'ENV=(NB_ORA_POLICY=BCV_ASM,NB_ORA_SCHED=FULL_BCV)' maxpiecesize 8 G;
7> backup full filesperset = 10 as BACKUPSET tag '%d_full_backup_%TAG' database;
8> release channel edw_backup_sbt1;
9> release channel edw_backup_sbt2;
10>release channel edw_backup_sbt3;
11>release channel edw_backup_sbt4;
12>}

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area 4194304000 bytes

Fixed Size 2089272 bytes
Variable Size 3976203976 bytes
Database Buffers 201326592 bytes
Redo Buffers 14684160 bytes

allocated channel: edw_backup_sbt1
channel edw_backup_sbt1: sid=4392 devtype=SBT_TAPE
channel edw_backup_sbt1: Veritas NetBackup for Oracle - Release 6.5 (2007111606)

allocated channel: edw_backup_sbt2
channel edw_backup_sbt2: sid=4386 devtype=SBT_TAPE
channel edw_backup_sbt2: Veritas NetBackup for Oracle - Release 6.5
(2007111606)

allocated channel: edw_backup_sbt3
channel edw_backup_sbt3: sid=4384 devtype=SBT_TAPE
channel edw_backup_sbt3: Veritas NetBackup for Oracle - Release 6.5 (2007111606)

allocated channel: edw_backup_sbt4
channel edw_backup_sbt4: sid=4382 devtype=SBT_TAPE
channel edw_backup_sbt4: Veritas NetBackup for Oracle - Release 6.5 (2007111606)

Starting backup at 10-DEC-08
released channel: edw_backup_sbt1
released channel: edw_backup_sbt2
released channel: edw_backup_sbt3
released channel: edw_backup_sbt4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of backup command at 12/10/2008 07:47:10
RMAN-03014: implicit resync of recovery catalog failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20035: invalid high recid


4.
Following is the complete procedure to take RMAN backup of BCV copy:

STEPS :
=======

1. Primary database has to be registered in the recovery catalog.


2. Verify the current RMAN Configuration.

show all;

* autobackup controlfile OFF


3. Take the BCV cut after the production database was shutdown with "shutdown immediate;".


4. On the staging server using BCV cut, Mount Database :

$ sqlplus / as sysdba

SQL> startup mount;


5. Check the controfile_type: (Controlfile type shoud be CURRENT ):

SQL> select controlfile_type from v$database;

CONTROL
---------
CURRENT


6. Connect to RMAN in nocatalog, take a backup of the controlfile and then restore it, you will have a backup controlfile then:

a.
$ rman target /

RMAN> run {
allocate channel disk1 device type disk;
backup current controlfile FORMAT '/u00/oradata/EDW/controlfile/current_controlfile1.ctl'; }
RMAN> exit;

b.
$ rman target /

RMAN> run {
allocate channel disk1 device type disk;
restore controlfile to '/u00/oradata/EDW/controlfile/backup_controlfile1.ctl' from '/u00/oradata/EDW/controlfile/current_controlfile1.ctl'; }
RMAN> exit;


7. Edit the init.ora file to point to the new controlfile (/u00/oradata/EDW/controlfile/backup_controlfile1.ctl)


8. Shutdown database:

SQL> shutdown immediate;


9. mount database:

SQL> startup mount;


10. Check the controfile_type : (Controlfile type shoud be BACKUP) :

SQL> select controlfile_type from v$database;

CONTROL
---------
BACKUP


11. Start RMAN session connected to this database mounted and the recovery catalog :

$ rman target / catalog rman/****@prman.world


12. Execute the backup.

RMAN> run {
2> startup mount;
3> allocate channel edw_backup_sbt1 type sbt format '%d_full_backup_%U' parms 'ENV=(NB_ORA_POLICY=BCV_ASM,NB_ORA_SCHED=FULL_BCV)' maxpiecesize 8 G;
4> allocate channel edw_backup_sbt2 type sbt format '%d_full_backup_%U' parms 'ENV=(NB_ORA_POLICY=BCV_ASM,NB_ORA_SCHED=FULL_BCV)' maxpiecesize 8 G;
5> allocate channel edw_backup_sbt3 type sbt format '%d_full_backup_%U' parms 'ENV=(NB_ORA_POLICY=BCV_ASM,NB_ORA_SCHED=FULL_BCV)' maxpiecesize 8 G;
6> allocate channel edw_backup_sbt4 type sbt format '%d_full_backup_%U' parms 'ENV=(NB_ORA_POLICY=BCV_ASM,NB_ORA_SCHED=FULL_BCV)' maxpiecesize 8 G;
7> backup full filesperset = 10 as BACKUPSET tag '%d_full_backup_%TAG' database;
8> release channel edw_backup_sbt1;
9> release channel edw_backup_sbt2;
10>release channel edw_backup_sbt3;
11>release channel edw_backup_sbt4;
12>}

Imp Note: If you want to open the database, edit the init.ora file to point to the original controlfile.

1 comment:

Anonymous said...

Thank you Vijay, this was very helpful. This is the workaround for bug 6004226, as the instructions in note 302615.1 say faking recovery should truly change the controlfile to a backup controlfile. Even though the query says the controlfile type is a backup, it still fails with that ridiculous RMAN error. Doing the actual recovery works.

Thanks Again