Configuring a Standby Database Using RMAN Active Duplication
Setting up a physical standby database is critical for disaster recovery and high availability in Oracle environments. In this guide, we’ll walk through creating a standby database using RMAN Active Duplication, streaming data directly from the primary database over the network without the need for backup files.
In this exercise we use Oracle Database, with the following configuration:
-
Primary DB: OMTSTCCB
-
Standby DB: OMDRCCB
Step 1: Enable Force Logging on the Primary
Force Logging ensures that all changes, including direct path loads, are logged in the redo logs and can be propagated to the standby database.Enable the database with the Force logging mode.
SQL> ALTER DATABASE FORCE LOGGING;
Database altered.
Step 2: Verify Archive Log Mode
SQL> select log_mode from v$database;
LOG_MODE
------------
ARCHIVELOG
Step 3: Check and Add Redo Log Groups
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME CON_ID
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ --------- ----------
1 1 4 52428800 512 1 NO CURRENT 13738981 30-AUG-17 2.8147E+14 0
2 1 2 52428800 512 1 YES ACTIVE 13738966 30-AUG-17 13738976 30-AUG-17 0
3 1 3 52428800 512 1 YES ACTIVE 13738976 30-AUG-17 13738981 30-AUG-17 0
SQL>
Step 4: Duplicate the Database Using RMAN (Active Duplication)
Switch to the standby server and run RMAN with the following command:RMAN> duplicate target database for standby from active database nofilenamecheck;
Starting Duplicate Db at 03-SEP-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=3763 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/u03/app/oracle/product/12.1.0/dbhome_1/dbs/orapwOMTSTCCB' auxiliary format
'/u03/app/oracle/product/12.1.0/dbhome_1/dbs/orapwOMDRCCB' ;
}
executing Memory Script
Starting backup at 03-SEP-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=381 device type=DISK
Finished backup at 03-SEP-17
contents of Memory Script:
{
restore clone from service 'OMTSTCCB' standby controlfile;
}
executing Memory Script
Starting restore at 03-SEP-17
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service OMTSTCCB
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u03/app/oracle/oradata/OMDRCCB/control01.ctl
Finished restore at 03-SEP-17
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/u03/app/oracle/oradata/OMDRCCB/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/u03/app/oracle/oradata/OMDRCCB/system01.dbf";
set newname for datafile 2 to
"/u03/app/oracle/oradata/OMDRCCB/cists01.dbf";
set newname for datafile 3 to
"/u03/app/oracle/oradata/OMDRCCB/sysaux01.dbf";
set newname for datafile 4 to
"/u03/app/oracle/oradata/OMDRCCB/undotbs01.dbf";
set newname for datafile 6 to
"/u03/app/oracle/oradata/OMDRCCB/users01.dbf";
restore
from service 'OMTSTCCB' clone database
;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u03/app/oracle/oradata/OMDRCCB/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 03-SEP-17
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service OMTSTCCB
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u03/app/oracle/oradata/OMDRCCB/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service OMTSTCCB
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u03/app/oracle/oradata/OMDRCCB/cists01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service OMTSTCCB
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u03/app/oracle/oradata/OMDRCCB/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:05:05
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service OMTSTCCB
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u03/app/oracle/oradata/OMDRCCB/undotbs01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service OMTSTCCB
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u03/app/oracle/oradata/OMDRCCB/users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 03-SEP-17
sql statement: alter system archive log current
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=953735223 file name=/u03/app/oracle/oradata/OMDRCCB/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=953735223 file name=/u03/app/oracle/oradata/OMDRCCB/cists01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=953735223 file name=/u03/app/oracle/oradata/OMDRCCB/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=953735223 file name=/u03/app/oracle/oradata/OMDRCCB/undotbs01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=9 STAMP=953735223 file name=/u03/app/oracle/oradata/OMDRCCB/users01.dbf
Finished Duplicate Db at 03-SEP-17
RMAN> exit
-
Copies the password file
-
Restores the standby control file from the primary
-
Mounts the standby database
-
Restores all datafiles via network from primary
-
Switches to the restored datafile copies
-
Archives the current log on the primary
All operations are logged with elapsed time, making it easy to monitor the progress and performance.
Final Result
After RMAN finishes the duplication, the standby database (OMDRCCB
) is mounted and ready to start managed recovery. This standby is a real-time copy of the primary and can now be integrated into your Data Guard configuration for high availability and disaster recovery.
Notes
NOFILENAMECHECK is used when the primary and standby databases reside on the same storage layout
Ensure the listener and TNS are properly configured for the service names (OMTSTCCB and OMDRCCB).
The Data Guard broker or manual setup can be used to manage log shipping and role transitions after this step.
Conclusion
Using RMAN Active Duplication simplifies the creation of a physical standby by eliminating the need for manual backups or file copies. With just a few steps, a fully functional standby can be created directly from the primary database, making your DR setup faster and more reliable.