Thursday, July 4, 2013

Oracle 11g Data Guard Broker DGMGRL Configuration Steps


This note describes the commands used to create a Data Guard broker configuration using the command line dgmgrl interface. This can also be done via the Enterprise Manager Grid Control GUI as well and the assumption is that there is a Physical Standby database in place and archives shipping have already been configured and that both the Primary and Standby database are in sync.
Primary Database: odtest_nrc
Standby Database: odtest_dnv
Step-1
Edit the listener.ora on both primary and standby side’s to add a static entry for DGMGRL and restart the listener.
This is to prevent the ORA-12154 error which can be observed on startup of the standby database after performing a switchover.
Ensure that the GLOBAL_DBNAME is set to db_unique_name_DGMGRL
SID_LIST_<LISTENER_NAME>=(SID_LIST=(SID_DESC=(SID_NAME=<INSTANCE_NAME>)(GLOBAL_DBNAME=<DB_UNIQUE_NAME>_DGMGRL)(ORACLE_HOME=<ORACLE_HOME>)))

Ex:
odtest1:/home/oracle>tail -1 /u01/app/11.2.0.3/grid/network/admin/listener.ora
SID_LIST_LISTENER_ODTEST=(SID_LIST=(SID_DESC=(SID_NAME=odtest1)(GLOBAL_DBNAME=odtest_nrc_DGMGRL)(ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1)))

+ASM1:/home/grid>lsnrctl reload LISTENER_ODTEST
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 21-MAR-2013 07:46:57
 Copyright (c) 1991, 2011, Oracle.  All rights reserved.
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_ODTEST)))
The command completed successfully
+ASM1:/home/grid>lsnrctl status LISTENER_ODTEST
 LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 21-MAR-2013 07:47:05
 Copyright (c) 1991, 2011, Oracle.  All rights reserved.
 Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_ODTEST)))
STATUS of the LISTENER
------------------------
Alias                     listener_odtest
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                15-MAR-2013 12:13:44
Uptime                    5 days 19 hr. 33 min. 21 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0.3/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/nolxorxxcc01/listener_odtest/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_ODTEST)))
Services Summary...
Service "odtest_nrc_DGMGRL" has 1 instance(s).
  Instance "odtest1", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
 odtest1:/home/oracle>cat /u01/app/oracle/product/11.2.0.3/dbhome_1/network/admin/tnsnames.ora
ODTEST_DNV=
        (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP) (HOST = opgrid03-scan.corp.ocwen.com ) (PORT = 1523))
    (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = odtest_dnv)))

ODTEST_NRC=
        (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP) (HOST = testgrid-scan.corp.ocwen.com ) (PORT = 1523))
    (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = odtest_nrc)))

Step-2
Configure the Data Guard Broker parameters and start the broker process on both Primary as well as standby database.
      DG_BROKER_CONFIG_FILE1='/u02/oradata/dba/admin/<DB_NAME>/pfile/dgb_config01.ora'

      DG_BROKER_CONFIG_FILE12='/u02/oradata/dba/admin/<DB_NAME>/pfile/dgb_config02.ora'

DG_BROKER_START=TRUE


Ex:
SQL> ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='/u02/oradata/dba/admin/odtest/pfile/dgb_config01.ora' SCOPE=BOTH;

System altered.

SQL> ALTER SYSTEM SET DG_BROKER_CONFIG_FILE12='/u02/oradata/dba/admin/odtest/pfile/dgb_config02.ora' SCOPE=BOTH;

System altered.

SQL> ALTER SYSTEM SET DG_BROKER_START=TRUE SCOPE=BOTH; --This parameter starts the broker process

System altered.



Step-3
Create the configuration
odtest1:/home/oracle>dgmgrl
DGMGRL for Linux: Version 11.2.0.3.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/xxxx
Connected.
DGMGRL> CREATE CONFIGURATION '<DB_NAME>' AS PRIMARY DATABASE IS '<DB_UNIQUE_NAME>' CONNECT IDENTIFIER IS '<TNS_ALIAS>';
Add the Standby database to the configuration
DGMGRL>  ADD DATABASE '<DB_UNIQUE_NAME>' AS CONNECT IDENTIFIER IS '<TNS_ALIAS>' ;

DGMGRL> CREATE CONFIGURATION 'odtest' AS PRIMARY DATABASE IS 'odtest_nrc' CONNECT IDENTIFIER IS 'odtest_nrc';
Configuration "odtest" created with primary database "odtest_nrc"

DGMGRL> ADD DATABASE 'odtest_dnv' AS CONNECT IDENTIFIER IS 'odtest_dnv';
Database "odtest_dnv" added

Change the properties of a configured databases

DGMGRL> edit database odtest_dnv set property LogXptMode='ARCH';
Property "logxptmode" updated

DGMGRL> edit database odtest_nrc set property LogXptMode='ARCH';
Property "logxptmode" updated

DGMGRL> edit database odtest_dnv set property ArchiveLagTarget=1800;
Property "archivelagtarget" updated

DGMGRL> edit database odtest_nrc set property ArchiveLagTarget=1800;
Property "archivelagtarget" updated

DGMGRL> show configuration

Configuration - odtest

  Protection Mode: MaxPerformance
  Databases:
    odtest_nrc - Primary database
    odtest_dnv - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

Step-4
Enable the configuration
DGMGRL> ENABLE CONFIGURATION
Enabled.

DGMGRL> ENABLE CONFIGURATION
Enabled.

DGMGRL> show configuration

Configuration - odtest

  Protection Mode: MaxPerformance
  Databases:
    odtest_nrc - Primary database
    odtest_dnv - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

View the Standby and Primary database properties
DGMGRL> show database odtest_nrc
Database - odtest_nrc
  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    odtest1
Database Status:
SUCCESS
DGMGRL>  show database verbose odtest_nrc
Database - odtest_nrc
  Role:            PRIMARY
  Intended State:  TRANSPORT-ON
  Instance(s):
    odtest1
  Properties:
    DGConnectIdentifier             = 'odtest_nrc'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'ARCH'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    LogShipping                     = 'ON'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyParallel                   = 'AUTO'
    StandbyFileManagement           = 'AUTO'
    ArchiveLagTarget                = '900'
    LogArchiveMaxProcesses          = '4'
    LogArchiveMinSucceedDest        = '1'
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    FastStartFailoverTarget         = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    SendQEntries                    = '(monitor)'
    LogXptStatus                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    SidName                         = 'odtest1'
    StaticConnectIdentifier         = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(HOST=10.20.6.19)(PORT=1545))(CONNECT_DATA=
(SERVICE_NAME=odtest_nrc_DGMGRL)
(INSTANCE_NAME=odtest1)(SERVER=DEDICATED)))'
    StandbyArchiveLocation          = '+DATA03T'
    AlternateLocation               = ''
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = 'odtest_%t_%s_%r.arc'
    TopWaitEvents                   = '(monitor)'
    Database Status:
   SUCCESS
 DGMGRL>  show database odtest_dnv
Database - odtest_dnv
  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   10 minutes 14 seconds
  Apply Lag:       10 minutes 14 seconds
  Real Time Query: OFF
  Instance(s):
    odtest1
Database Status:
SUCCESS
DGMGRL> show database verbose odtest_dnv
Database - odtest_dnv
  Role:            PHYSICAL STANDBY
  Intended State:  APPLY-ON
  Transport Lag:   12 minutes 14 seconds
  Apply Lag:       12 minutes 14 seconds
  Real Time Query: OFF
  Instance(s):
    odtest1
  Properties:
    DGConnectIdentifier             = 'odtest_dnv'
    ObserverConnectIdentifier       = ''
    LogXptMode                      = 'ARCH'
    DelayMins                       = '0'
    Binding                         = 'optional'
    MaxFailure                      = '0'
    MaxConnections                  = '1'
    ReopenSecs                      = '300'
    NetTimeout                      = '30'
    RedoCompression                 = 'DISABLE'
    LogShipping                     = 'ON'
    PreferredApplyInstance          = ''
    ApplyInstanceTimeout            = '0'
    ApplyParallel                   = 'AUTO'
    StandbyFileManagement           = 'AUTO'
    ArchiveLagTarget                = '900'
    LogArchiveMaxProcesses          = '4'
    LogArchiveMinSucceedDest        = '1'
    DbFileNameConvert               = ''
    LogFileNameConvert              = ''
    FastStartFailoverTarget         = ''
    InconsistentProperties          = '(monitor)'
    InconsistentLogXptProps         = '(monitor)'
    SendQEntries                    = '(monitor)'
    LogXptStatus                    = '(monitor)'
    RecvQEntries                    = '(monitor)'
    SidName                         = 'odtest1'
    StaticConnectIdentifier         = '(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=10.22.6.58)
(PORT=1545))(CONNECT_DATA=(SERVICE_NAME=
odtest_dnv_DGMGRL)(INSTANCE_NAME=odtest1)
(SERVER=DEDICATED)))'
    StandbyArchiveLocation          = '+DATA03T'
    AlternateLocation               = ''
    LogArchiveTrace                 = '0'
    LogArchiveFormat                = '%t_%s_%r.arc'
    TopWaitEvents                   = '(monitor)'
Database Status:
SUCCESS

Performing a switchover
Note: In this case, currently the Primary Database is odtest_nrc and the Standby database is odtest_dnv.
DGMGRL> switchover to odtest_dnv
Performing switchover NOW, please wait...
New primary database "odtest_dnv" is opening...
Operation requires shutdown of instance "odtest1" on database "odtest_nrc"
Shutting down instance "odtest1"...
ORACLE instance shut down.
Operation requires startup of instance "odtest1" on database "odtest_nrc"
Starting instance "odtest1"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "odtest_dnv"

DGMGRL> show configuration

Configuration - odtest

  Protection Mode: MaxPerformance
  Databases:
    odtest_dnv - Primary database
    odtest_nrc - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS
Note: Don’t test on production databases
Switch Back
Note: In this case, currently the Primary Database is odtest_dnv and the Standby database is odtest_nrc
DGMGRL>  switchover to odtest_nrc;
Performing switchover NOW, please wait...
New primary database "odtest_nrc" is opening...
Operation requires shutdown of instance "odtest1" on database "odtest_dnv"
Shutting down instance "odtest1"...
ORACLE instance shut down.
Operation requires startup of instance "odtest1" on database "odtest_dnv"
Starting instance "odtest1"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "odtest_nrc"

DGMGRL> show configuration

Configuration - odtest

  Protection Mode: MaxPerformance
  Databases:
    odtest_nrc - Primary database
    odtest_dnv - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

Monitoring the Data Guard Broker Configuration
If we receive any error or warnings we can obtain more information about the same by running the commands as shown below. In this case there is no output seen because currently we are not experiencing any errors or warning.
DGMGRL> show database odtest_nrc statusreport
STATUS REPORT
       INSTANCE_NAME   SEVERITY ERROR_TEXT

DGMGRL> show database odtest_nrc logxptstatus
LOG TRANSPORT STATUS
PRIMARY_INSTANCE_NAME STANDBY_DATABASE_NAME               STATUS
             odtest1           odtest_dnv

DGMGRL> show database  odtest_nrc InconsistentProperties
INCONSISTENT PROPERTIES
   INSTANCE_NAME        PROPERTY_NAME         MEMORY_VALUE         SPFILE_VALUE         BROKER_VALUE


No comments:

Post a Comment