Steps to Setup Data Guard Broker (DG BROKER) in Oracle 12c RAC Database with ASM

_____________________________________________________________________________________________________________________

You have setup the data guard in your primary & standby database and apply is working properly. Steps to Setup Data Guard
Primary Configuration
1.      Create the directory structure in Primary ASM as follows. Login as grid/oracle whichever is the owner of the ASM

            $>. oraenv
            $>+ASM1
            $>asmcmd
ASMCMD> cd +DATA/ADMPROD
ASMCMD> mkdir DATAGUARDCONFIG

2.      Stop the recovery in standby database.
alter database recover managed standby database cancel;

3.      Login as Oracle user in Primary database server and execute following.
alter system set LOG_ARCHIVE_DEST_2='' scope=both;
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+DATA/ADMPROD/DATAGUARDCONFIG/dg_conf1.ora' SCOPE=spfile sid='*';
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+DATA/ADMPROD/DATAGUARDCONFIG/dg_conf2.ora' SCOPE=spfile sid='*';
alter system set dg_broker_start=true scope=both sid='*';

Execution logs
SQL> alter system set LOG_ARCHIVE_DEST_2='' scope=both;

System altered.

SQL> ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+DATA/ADMPROD/DATAGUARDCONFIG/dg_conf1.ora' SCOPE=spfile sid='*';

System altered.

SQL> ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+DATA/ADMPROD/DATAGUARDCONFIG/dg_conf2.ora' SCOPE=spfile sid='*';

System altered.

SQL> alter system set dg_broker_start=true scope=both sid='*';

System altered.

Standby Configuration
1.      Create the directory structure in standby ASM as follows. Login as grid/oracle whichever is the owner of the ASM

ASMCMD> cd +DATA/ADMPRODSTBY
ASMCMD> mkdir DATAGUARDCONFIG
ASMCMD> cd DATAGUARDCONFIG
ASMCMD> pwd
+DATA/ADMPRODSTBY/DATAGUARDCONFIG

2.      Login as Oracle user in Primary database server and execute following.
alter system set LOG_ARCHIVE_DEST_2='' scope=both;
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+DATA/ADMPRODSTBY/DATAGUARDCONFIG/dg_conf1.ora' SCOPE=spfile sid='*';
ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+DATA/ADMPRODSTBY/DATAGUARDCONFIG/dg_conf2.ora' SCOPE=spfile sid='*';
alter system set dg_broker_start=true scope=both sid='*';
$ srvctl stop database -d admprodstby
$ srvctl start database -d admprodstby


Execution Logs
SQL> ALTER SYSTEM SET DG_BROKER_CONFIG_FILE1='+DATA/ADMPRODSTBY/DATAGUARDCONFIG/dg_conf1.ora' SCOPE=spfile sid='*';

System altered.

SQL> ALTER SYSTEM SET DG_BROKER_CONFIG_FILE2='+DATA/ADMPRODSTBY/DATAGUARDCONFIG/dg_conf2.ora' SCOPE=spfile sid='*';

System altered.

SQL> alter system set dg_broker_start=true scope=both sid='*';

System altered.

SQL> alter system set LOG_ARCHIVE_DEST_2='' scope=both sid='*';
System altered.

3.      Bounce both primary and standby
$ srvctl stop database -d admprod
$ srvctl start database -d admprod

$ srvctl stop database -d admprodstby
$ srvctl start database -d admprodstby

4.      Login to dgmgrl utility using sys password and enable the configuration.

DGMGRL> connect sys
Password:
Connected as SYSDG.
DGMGRL> CREATE CONFIGURATION 'DG_Conf' AS PRIMARY DATABASE IS 'ADMPROD' CONNECT IDENTIFIER IS 'ADMPROD';
Configuration "DG_Conf" created with primary database "ADMPROD"
DGMGRL> ADD DATABASE 'ADMPRODSTBY' AS CONNECT IDENTIFIER IS ADMPRODSTBY;
Database "ADMPRODSTBY" added
DGMGRL> show configuration;

Configuration - DG_Conf

  Protection Mode: MaxPerformance
  Members:
  ADMPROD     - Primary database
    ADMPRODSTBY - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
DISABLED

DGMGRL> enable configuration;
Enabled.
DGMGRL>  show configuration;

Configuration - DG_Conf

  Protection Mode: MaxPerformance
  Members:
  ADMPROD     - Primary database
    ADMPRODSTBY - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 83 seconds ago)

5.      To change the protection mode to MAX AVAILABILITY

edit database 'ADMPRODSTBY' set property 'LogXptMode'='sync';
edit database 'ADMPROD' set property 'LogXptMode'='sync';
edit configuration set protection mode as maxavailability;

DGMGRL> edit database 'ADMPRODSTBY' set property 'LogXptMode'='sync';
Property "LogXptMode" updated
DGMGRL> edit database 'ADMPROD' set property 'LogXptMode'='sync';
Property "LogXptMode" updated

DGMGRL> edit configuration set protection mode as maxavailability;
Succeeded.
DGMGRL>  show configuration;

Configuration - DG_Conf

  Protection Mode: MaxAvailability
  Members:
  ADMPROD     - Primary database
    ADMPRODSTBY - Physical standby database
     
Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 83 seconds ago)

6.      To test the switchover functionality
DGMGRL> switchover to 'ADMPRODSTBY';
Performing switchover NOW, please wait...
Operation requires a connection to instance "ADMPROD2" on database "ADMPRODSTBY"
Connecting to instance "ADMPROD2"...
Connected as SYSDBA.
New primary database "ADMPRODSTBY" is opening...
Oracle Clusterware is restarting database "ADMPROD" ...
Switchover succeeded, new primary is "ADMPRODSTBY"

DGMGRL> switchover to 'ADMPROD';
Performing switchover NOW, please wait...
Operation requires a connection to instance "ADMPROD1" on database "ADMPROD"
Connecting to instance "ADMPROD1"...
Connected as SYSDBA.
New primary database "ADMPROD" is opening...
Oracle Clusterware is restarting database "ADMPRODSTBY" ...
Switchover succeeded, new primary is "ADMPROD"

7.      You can check the database mode and role whether it is successfully switchover to standby and vice versa using following command
set pages 1000 lines 120

select inst_id, name, open_mode, database_role from gv$database;

_____________________________________________________________________________________________________________________

0 comments:

Post a Comment

 

acehints.com Copyright 2011-17 All Rights Reserved | Site Map | Contact | Disclaimer | Google