1

Physical Standby Configuration Using RMAN Duplicate

Oracle Data Guard 12c Physical Standby Configuration Using RMAN Duplicate and DGMGRL

This detailed blog explains how to configure Oracle Data Guard 12c Physical Standby Database using RMAN Active Duplicate and Data Guard Broker (DGMGRL). The guide includes listener configuration, tnsnames setup, standby redo logs, RMAN duplication, broker configuration, and read-only standby testing.

Environment Details

Primary Server:
Hostname : testweb.test.com
IP       : 192.168.0.82
DB_UNIQUE_NAME : primary

Standby Server:
Hostname : teststby.test.com
IP       : 192.168.0.83
DB_UNIQUE_NAME : stby

Oracle Version:
12.1.0.2

Step 1: Configure Hostname Resolution

Add the following entries in /etc/hosts on both primary and standby servers.

vi /etc/hosts

192.168.0.82 testweb.test.com testweb
192.168.0.83 teststby.test.com teststby

Step 2: Configure Oracle Listener

Remove or backup the existing listener.ora file before creating a new listener configuration.

Delete existing listener.ora or move it to backup location.

Launch Oracle Net Manager:

netmgr

Using Oracle Net Manager configure:

  • Oracle Net Configuration → Local → Listeners → Database Services
  • Add Global Database Name : ORCL
  • Oracle Net Configuration → Service Naming
  • Add service for primary database

Step 3: Configure TNS Entries on Primary

STBY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = teststby.test.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = stby)
    )
  )

STBY_DGMGRL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = teststby.test.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = stby_dgmgrl)
    )
  )

PRIMARY_DGMGRL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = testweb.test.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = primary_dgmgrl)
    )
  )

Step 4: Create Password File

orapwd file=orapw$ORACLE_SID password=oracle force=y

Configure sqlnet authentication:

vi 12.1.0/network/admin/sqlnet.ora

Verify SYSDBA access:

sqlplus sys/oracle as sysdba

Step 5: Configure Environment Variables

Add below entry in .bash_profile on primary server:

ORACLE_UNQNAME=primary

Step 6: Create PFILE and Configure DB_UNIQUE_NAME

sqlplus / as sysdba

create pfile from spfile;

vi /db/oracle/product/12.1.0.2/db_1/dbs/initORCL.ora

*.db_unique_name=’primary’

Step 7: Create Standby Redo Logs

ALTER DATABASE ADD STANDBY LOGFILE (‘/db/oracle/oradata/ORCL/onlinelog/standby_redo01.log’) SIZE 70M;
ALTER DATABASE ADD STANDBY LOGFILE (‘/db/oracle/oradata/ORCL/onlinelog/standby_redo02.log’) SIZE 70M;
ALTER DATABASE ADD STANDBY LOGFILE (‘/db/oracle/oradata/ORCL/onlinelog/standby_redo03.log’) SIZE 70M;
ALTER DATABASE ADD STANDBY LOGFILE (‘/db/oracle/oradata/ORCL/onlinelog/standby_redo04.log’) SIZE 70M;
ALTER DATABASE ADD STANDBY LOGFILE (‘/db/oracle/oradata/ORCL/onlinelog/standby_redo05.log’) SIZE 70M;
ALTER DATABASE ADD STANDBY LOGFILE (‘/db/oracle/oradata/ORCL/onlinelog/standby_redo06.log’) SIZE 70M;
ALTER DATABASE ADD STANDBY LOGFILE (‘/db/oracle/oradata/ORCL/onlinelog/standby_redo07.log’) SIZE 70M;

Step 8: Configure Data Guard Parameters

ALTER DATABASE FORCE LOGGING;

ALTER SYSTEM SET LOG_ARCHIVE_CONFIG=’DG_CONFIG=(primary,stby)’;

ALTER SYSTEM SET LOG_ARCHIVE_DEST_2=’SERVICE=stby NOAFFIRM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=STBY’;

ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;

Step 9: Configure Listener.ora

Primary Listener Configuration

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ORCL)
      (ORACLE_HOME = /db/oracle/product/12.1.0.2/db_1)
      (SID_NAME = ORCL)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = testweb.test.com)(PORT = 1521))
  )

ADR_BASE_LISTENER = /db/oracle

Standby Listener Configuration

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = stby)
      (ORACLE_HOME = /db/oracle/product/12.1.0.2/db_1)
      (SID_NAME = ORCL)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = teststby.test.com)(PORT = 1521))
  )

ADR_BASE_LISTENER = /db/oracle

Step 10: Duplicate Standby Database Using RMAN

rman TARGET sys/oracle@primary as sysdba AUXILIARY sys/oracle@stby as sysdba

RUN {
DUPLICATE TARGET DATABASE
FOR STANDBY
FROM ACTIVE DATABASE
DORECOVER
SPFILE
SET db_unique_name=’stby’
SET log_archive_max_processes=’5′
SET fal_client=’stby’
SET fal_server=’primary’
SET standby_file_management=’AUTO’
SET log_archive_config=’dg_config=(primary,stby)’
NOFILENAMECHECK;
}

Step 11: Configure FAL Parameters

ALTER SYSTEM SWITCH LOGFILE;

SHOW PARAMETER fal_;

ALTER SYSTEM SET fal_client=’primary’ SCOPE=spfile;
ALTER SYSTEM SET fal_server=’stby’ SCOPE=spfile;

SHUTDOWN IMMEDIATE;
STARTUP;

Step 12: Configure Data Guard Broker

ALTER SYSTEM SET dg_broker_start=TRUE SCOPE=BOTH;

dgmgrl

CONNECT sys/oracle

CREATE CONFIGURATION ‘DGConfig1’
AS PRIMARY DATABASE IS ‘primary’
CONNECT IDENTIFIER IS PRIMARY_DGMGRL;

ADD DATABASE ‘stby’
AS CONNECT IDENTIFIER IS STBY_DGMGRL;

ENABLE CONFIGURATION;

Step 13: Test Read-Only Standby

Stop Apply:

DGMGRL> edit database ‘stby’ set state=’apply-off’;

Open Standby Read Only:

ALTER DATABASE OPEN READ ONLY;

Start Apply:

DGMGRL> edit database ‘stby’ set state=’apply-on’;

Validation Queries

SELECT database_role, open_mode FROM v$database;

SELECT process, status FROM v$managed_standby;

SELECT dest_name, status, error FROM v$archive_dest;

SELECT sequence#, applied FROM v$archived_log ORDER BY sequence#;

Common DBA Issues

  • Listener configuration mismatch
  • TNS resolution issues
  • Archive gap errors
  • FAL_SERVER/FAL_CLIENT misconfiguration
  • Password file mismatch
  • Redo transport lag
  • Broker communication failures

Best Practices

  • Deploy standby database in separate data center or OCI region
  • Enable FORCE LOGGING on primary
  • Use standby redo logs
  • Monitor archive apply lag regularly
  • Test failover and switchover periodically
  • Use Data Guard Broker for easier administration

Conclusion

Oracle Data Guard remains one of the most powerful disaster recovery solutions for Oracle databases. By combining RMAN Active Duplicate, Data Guard Broker, and standby redo logs, organizations can build highly available and resilient Oracle database environments.

    About Abdul Khalique Siddique

    In addition to my proficiency in Oracle Database, I have also specialized in Oracle E-Business Suite. I have hands-on experience in implementing, configuring, and maintaining EBS applications, enabling organizations to streamline their business processes and achieve operational efficiency. Also I have hands-on experience in Oracle Cloud Infrastructure (OCI). I have worked with OCI services such as compute, storage, networking, and database offerings, leveraging the power of the cloud to deliver scalable and cost-effective solutions. My knowledge of OCI architecture and deployment models allows me to design and implement robust and secure cloud environments for various business requirements. Furthermore, I have specialized in disaster recovery solutions for Oracle technologies. I have designed and implemented comprehensive disaster recovery strategies, including backup and recovery procedures, standby databases, and high availability configurations. My expertise in data replication, failover mechanisms, and business continuity planning ensures that organizations can quickly recover from disruptions and maintain uninterrupted operations.

    Check Also

    Step-by-Step Guide to Convert Physical Standby to Snapshot Standby

    Complete Step-by-Step Guide to Convert Physical Standby to Snapshot Standby   Introduction Recently, I had …

    Leave a Reply