This document is being delivered to you via Oracle Support's
Rapid Visibility (RaV)
process, and therefore has not been subject to an independent technical review.
Applies to:
Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 10.2.0.4
Information in this document applies to any platform.
Oracle Server Enterprise Edition - Version: 10.2.0.1 to 10.2.0.4
Goal
The following note describes step-by-step procedure to create physical
standby by using RMAN duplicate without shutting down the primary
(Production) database.
Database Name :- prim Primary db_unique_name :- prim standby db_unique_name :- stdby
NOTE: Create password file if not present, also check if archiving enabled.
STEP: 2
Configure a Standby Redo Log on primary,
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 3 '/u01/app/oracle/databases/prim/redo/log3a.log' size 50m;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 '/u01/app/oracle/databases/prim/redo/log4a.log' size 50m;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 '/u01/app/oracle/databases/prim/redo/log5a.log' size 50m;
Database altered.
SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 '/u01/app/oracle/databases/prim/redo/log6a.log' size 50m;
Database altered.
NOTE: To check the number of SRL,
(maximum number of logfiles for each thread + 1) * maximum number
of threads
For example, if the primary database has 3 log files for each thread and 2 threads, then 8 standbys redo log
file groups are needed on the standby database.
Verify the standby redo log file groups were created.
SQL> SELECT GROUP#,ThREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;
STEP :3
Modify the primary initialization parameter for dataguard on primary,
SQL>alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(prim,stdby)';
System altered.
SQL>
alter system set
LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/databases/prim/redo/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=prim';
System altered.
SQL>alter
system set LOG_ARCHIVE_DEST_2='SERVICE=stdby LGWR ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=stdby';
System altered.
SQL> alter system set LOG_ARCHIVE_DEST_STATE_1=ENABLE;
System altered.
SQL>alter system set FAL_SERVER=stdby;
System altered.
SQL>alter system set FAL_CLIENT=prim;
System altered.
SQL>alter
system set
DB_FILE_NAME_CONVERT='/u01/app/oracle/databases/prim/data/','/u01/app/oracle/databases/stdby/data'
scope=spfile;
System altered.
SQL>alter
system set
LOG_FILE_NAME_CONVERT='/u01/app/oracle/databases/prim/redo/','/u01/app/oracle/databases/stdby/redo'
scope=spfile;
System altered.
STEP:4
Run the backup job at the primary by connecting to target and catalog DB(if any)
run { allocate channel c1 type disk; allocate channel
c2 type disk; backup database format '/u01/app/oracle/databases/stage/%U'; backup archivelog all format '/u01/app/oracle/databases/stage/%U';
backup current controlfile for standby format '/u01/app/oracle/databases/stage/%U'; }
using target database
control file instead of recovery catalog allocated channel: c1 channel c1: sid=22 devtype=DISK
Starting backup at 05-MAR-09 channel c1: starting
full datafile backupset channel c1: specifying datafile(s) in backupset including standby control file in backupset channel
c1: starting piece 1 at 05-MAR-09 channel c1: finished piece 1 at 05-MAR-09 piece handle=/u01/app/oracle/databases/stage/13k95lji_1_1
tag=TAG20090305T143634 comment=NONE channel c1: backup set complete, elapsed time: 00:00:02 Finished backup at 05-MAR-09 released channel: c1 released channel: c2
STEP :5
Create parameter file on primary copy it to standby and make the necessary changes,
SQL>create pfile='/u01/app/oracle/databases/prim/stage/initstdby.ora' from spfile;
File created.
STEP :6
Copy the listener.ora,tnsname.ora and sqlnet.ora files into staging directory.
b.
Alternatively we can copy the backups to standby different directory.
On standby server connect to RMAN target as primary and auxiliary
instance or if your primary is having catalog database then connect to
target as primary, catalog database and auxiliary instance. Catalog
those backup pieces to let the controlfile of primary or catalog
database to know the backup information.
For details on how to catalog backup piece refer,
Note 470463.1 - How To Catalog Backups / Archivelogs / Datafile Copies / Controlfile Copies
STEP: 8
Make the necessary changes on the copied initstdby.ora file on standby.
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Mar 5 12:30:56 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: PRIM (DBID=3971986030)
connected to auxiliary database: PRIM (DBID=3971986030, not open)
RMAN> duplicate target database for standby dorecover;
Starting Duplicate Db at 05-MAR-09 using target database control file instead of recovery catalog allocated channel:
ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: sid=36 devtype=DISK
contents of Memory Script: { set until scn 503194;
restore clone standby controlfile; sql clone 'alter database mount standby database'; } executing Memory Script
executing command: SET until clause
Starting restore at 05-MAR-09 using channel ORA_AUX_DISK_1
sql statement: alter database mount standby database released channel: ORA_AUX_DISK_1
contents of Memory Script:
{ set until scn 503194; set newname for datafile 1 to "/u01/app/oracle/databases/stdby/data/system01.dbf"; set newname for datafile 2 to "/u01/app/oracle/databases/stdby/data/undotbs01.dbf"; set newname for datafile 3 to "/u01/app/oracle/databases/stdby/data/sysaux01.dbf"; restore check readonly clone database ; } executing Memory Script
Note 183570.1 - Creating a Data Guard Database with RMAN (Recovery Manager) using Duplicate Command Note 466321.1 - RMAN Duplicate For Standby Fails with Rman-06024: No Backup Or Copy Of The Control File Found To Restore