Configure Dataguard Broker in oracle 12c

There are 5 steps to configure the DG broker:

  • Configure Listener file on both Primary and Standby database, Add the below lines in the listener file.
  • Reload the listener on both primary and standby
  • Enable dg broker related parameters on both primary and standby database
  • Configure DGMGRL
  • Enable the configuration

Step-1: Configure Listener file on both Primary and Standby database, Add the below lines in the listener file.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = primdb)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = primdb)
    )
(SID_DESC =
      (GLOBAL_DBNAME = stndb)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = stndb)
    )
(SID_DESC =
      (GLOBAL_DBNAME = primdb_DGMGRL)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = primdb)
    )
(SID_DESC =
      (GLOBAL_DBNAME = stndb_DGMGRL)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = primdb)
    )
  )


My listener file looks like this:

Primary:

[oracle@prim admin]$ cat listener.ora

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = primdb)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = primdb)
    )
(SID_DESC =
      (GLOBAL_DBNAME = stndb)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = stndb)
    )
(SID_DESC =
      (GLOBAL_DBNAME = primdb_DGMGRL)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = primdb)
    )
(SID_DESC =
      (GLOBAL_DBNAME = stndb_DGMGRL)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = primdb)
    )
  )

Standby:

[oracle@standby admin]$ cat listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = primdb)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = primdb)
    )
(SID_DESC =
      (GLOBAL_DBNAME = stndb)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = stndb)
    )
(SID_DESC =
      (GLOBAL_DBNAME = primdb_DGMGRL)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = primdb)
    )
(SID_DESC =
      (GLOBAL_DBNAME = stndb_DGMGRL)
      (ORACLE_HOME= /u01/app/oracle/product/12.2.0/dbhome_1)    
      (SID_NAME = primdb)
    )
  )


Step-2: reload the listener on both primary and standby

lsnrctl reload <listener_name>


Step-3: Enable dg broker related parameters on both primary and standby database

Primary:

SQL> ALTER SYSTEM SET dg_broker_start=true;

System altered.

SQL> ALTER SYSTEM SET local_listener='(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.29.101)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = primdb)))';

System altered.

Standby:

SQL> ALTER SYSTEM SET dg_broker_start=true;

System altered.

SQL> ALTER SYSTEM SET local_listener='(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.29.102)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = stndb)))';

System altered.

Step-4: Configure DGMGRL

a) Connect using primary database credentials:

[oracle@prim admin]$ dgmgrl
DGMGRL for Linux: Release 12.2.0.1.0 - Production on Tue Apr 5 03:51:59 2022

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys@primdb
Password:
Connected to "primdb"
Connected as SYSDBA.
DGMGRL> show configuration;
ORA-16525: The Oracle Data Guard broker is not yet available.

Configuration details cannot be determined by DGMGRL

b) configure DG Broker for primary database

DGMGRL> create configuration 'Primarydb' as primary database is 'primdb' connect identifier is primdb;
Configuration "Primarydb" created with primary database "primdb"
DGMGRL> show configuration;

Configuration - Primarydb

  Protection Mode: MaxPerformance
  Members:
  primdb - Primary database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

c) Add standby database to DG broker configuration

Note: make sure to reset the log_archive_dest_2 parameter or any dest location used for standby database (like Service parameter used) to avoid the below error. For my case I have used dest_2 parameter so have reset it.

Error:

DGMGRL> Add database 'stndb' as connect identifier is stndb maintained as physical;
Error: ORA-16698: member has a LOG_ARCHIVE_DEST_n parameter with SERVICE attribute set

Failed.

Reset the below parameter on both primary and standby databases.

SQL> alter system set log_archive_dest_2='';

System altered.


try adding the standby database into DG broker configuration,

DGMGRL> Add database 'stndb' as connect identifier is stndb maintained as physical;
Database "stndb" added
DGMGRL> show configuration;

Configuration - Primarydb

  Protection Mode: MaxPerformance
  Members:
  primdb - Primary database
    stndb  - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

Step-5: Enable the configuration

DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration

Configuration - Primarydb

  Protection Mode: MaxPerformance
  Members:
  primdb - Primary database
    stndb  - Physical standby database 

Fast-Start Failover: DISABLED

Configuration Status:
WARNING   (status updated 34 seconds ago)


Comments

Popular posts from this blog

Auditing in Oracle database

rs.stepDown() in MongoDB replication

Tuples in Python