Overview
Oracle Data Guard Broker is a self sustaining configuration, which allows you to manage the Dataguard in more simple way. With the Broker you can start observer, perform switchover and failover. Also, you can change the Protection mode and define a redo log routes. As such, the Data Guard Broker provide a set of utilities to the DBA to manage the Data Guard in easier way.
You can see a brief architecture of the broker. The broker can be started from a 3rd server, but the configuration has to be sure with all instances. Because of that, it is recommended to be stored on the shared data location (ASM in our case)
Before we configure the Broker, we need again to prepare the standby and the primary, as there are some settings that needs to be fixed :)
Preparation
To prepare the primary and standby, we have to move the password file to shared location and reset the destination parameters:
Note: As of Oracle Database 12c Release 1 (12.1), for all databases to be added to a broker configuration, any LOG_ARCHIVE_DEST_n parameters that have the SERVICE attribute set, but not the NOREGISTER attribute, must be cleared.
Prepare Primary & Standby
--Primary ----Unlock the Broker User [oracle@enode01 ~]$ SQL> alter user sysdg identified by oracle_4U; User altered. SQL> alter user sysdg account unlock; User altered. SQL> exit; ----Password file Export: [oracle@enode01 ~]$ scp /tmp/orapweastdb wnode03:/tmp/orapwwestdb orapweastdb 100% 7680 7.5KB/s 00:00 [oracle@enode01 ~]$ ----Log destination Reset [oracle@enode01 ~]$ sqlplus / as sysdba SQL> alter system set log_archive_dest_2='' scope=both sid='*'; System altered. SQL> alter system set dg_broker_config_file1='+data/eastdb/dr1config.dat' scope=both sid='*'; System altered. SQL> alter system set dg_broker_config_file2='+fra/eastdb/dr2config.dat' scope=both sid='*'; System altered. SQL> alter system set dg_broker_start=true scope=both sid='*'; System altered. SQL> exit --Standby ----Password file import: [grid@wnode03 ~]$ asmcmd pwcopy /tmp/orapwwestdb +data/westdb/orapwwestdb copying /tmp/orapwwestdb -> +data/westdb/orapwwestdb [grid@wnode03 ~]$ su - oracle [oracle@wnode03 ~]$ export ORACLE_SID=westdb1 [oracle@wnode03 ~]$ srvctl modify database -db westdb -pwfile +data/westdb/orapwwestdb ----Cancel Apply & Log destination Reset [oracle@wnode03 ~]$ sqlplus / as sysdba SQL> alter database recover managed standby database cancel; Database altered. SQL> alter system set log_archive_dest_2='' scope=both sid='*'; System altered. SQL> alter system set dg_broker_config_file1='+data/westdb/dr1config.dat' scope=both sid='*'; System altered. SQL> alter system set dg_broker_config_file2='+fra/westdb/dr2config.dat' scope=both sid='*'; System altered SQL> alter system set dg_broker_start=true scope=both sid='*'; System altered. SQL> exit [oracle@wnode03 ~]$ ----Verificaiton [oracle@wnode03 ~]$ dgmgrl DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production Copyright (c) 2000, 2012, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. DGMGRL> connect sysdg/oracle_4U@westdb Connected as SYSDG. DGMGRL> connect sysdg/oracle_4U@eastdb Connected as SYSDG. DGMGRL> exit [oracle@wnode03 ~]$
Configuration
The configuration is done on the primary and then the configuration is edited to include the standby as well:
Configure DG Broker
[oracle@enode01 ~]$ dgmgrl DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production Copyright (c) 2000, 2012, Oracle. All rights reserved. Welcome to DGMGRL, type "help" for information. DGMGRL> connect sysdg/oracle_4U@eastdb Connected as SYSDG. DGMGRL> show configuration ORA-16532: Data Guard broker configuration does not exist Configuration details cannot be determined by DGMGRL DGMGRL> 'eastdb' connect identifier is eastdb; Configuration "dg_config" created with primary database "eastdb" DGMGRL> show configuration Configuration - dg_config Protection Mode: MaxPerformance Members: eastdb - Primary database Fast-Start Failover: DISABLED Configuration Status: DISABLED DGMGRL> DGMGRL> add database 'westdb' as connect identifier is westdb; Database "westdb" added DGMGRL> show configuration Configuration - dg_config Protection Mode: MaxPerformance Members: eastdb - Primary database westdb - Physical standby database Fast-Start Failover: DISABLED Configuration Status: DISABLED DGMGRL>
Management
Now that we have the configuration, we can change the configuration for the data guard:
Change the Redo Rules to SYNC
Set Redo Rules to SYNC
DGMGRL> EDIT DATABASE 'eastdb' SET PROPERTY 'RedoRoutes' = '(eastdb:westdb SYNC)'; Property "RedoRoutes" updated DGMGRL> EDIT DATABASE 'westdb' SET PROPERTY 'RedoRoutes' = '(westdb:eastdb SYNC)'; Property "RedoRoutes" updated DGMGRL> DGMGRL> edit database westdb set property MaxConnections=4; DGMGRL> edit database eastdb set property MaxConnections=4; DGMGRL> DGMGRL> edit configuration set property CommunicationTimeout = 300; <- How many seconds before Broker decides Network timeout. Property "communicationtimeout" updated DGMGR DGMGRL> edit configuration set property OperationTimeout = 600; <- specifies the maximum amount of time the broker should wait for health check, get monitorable property, and set property operations to complete Property "operationtimeout" updated DGMGRL>
Change Protection Mode to Max Availability
Change Protection Mode
DGMGRL> edit configuration set protection mode as MaxAvailability; Succeeded. DGMGRL DGMGRL> enable configuration Enabled. DGMGRL> show configuration Configuration - dg_config Protection Mode: MaxAvailability Members: eastdb - Primary database westdb - Physical standby database Fast-Start Failover: DISABLED Configuration Status: SUCCESS (status updated 75 seconds ago) DGMGRL>
Verify Transportation & Apply
From the Broker it is very easy to verify both Transportation & Apply
Verify Transportation & Apply
DGMGRL> show database eastdb Database - eastdb Role: PRIMARY Intended State: TRANSPORT-ON Instance(s): eastdb1 eastdb2 Database Status: SUCCESS DGMGRL DGMGRL> DGMGRL> show database westdb Database - westdb Role: PHYSICAL STANDBY Intended State: APPLY-ON Transport Lag: 0 seconds (computed 1 second ago) Apply Lag: 0 seconds (computed 1 second ago) Average Apply Rate: 8.00 KByte/s Real Time Query: OFF Instance(s): westdb1 westdb2 (apply instance) <- We ALWAYS HAVE only ONE apply instance. Database Status: SUCCESS