This post list the steps for adding a data guard broker to an existing 12.2 Data Guard setup. There's an earlier post on setting up data guard broker on 12cR1. The primary database is called prodcdb and standby database is called stbycdb (refer here for other names in DG setup).
12.2 also introduced several new features. Below are few highlights from the DG broker guide.
To increase high availability, you can now set multiple fast-start failover targets and the broker automatically selects which one to use.
You can now start observers on multiple hosts to manage a single Data Guard broker configuration.
The new Data Guard broker property ApplyInstances can be used to engage multiinstance Redo Apply as well as to restrict the number of instances that are involved in redo apply on an Oracle Real Application Clusters (Oracle RAC) database.
The broker now supports migrating a pluggable database (PDB) from one multitenant container database (CDB) to another on the same host. You can migrate a PDB from a primary CDB to another primary CDB or failover a PDB from a standby CDB to a primary CDB.
The DGMGRL commands SHOW DATABASE VERBOSE and SHOW INSTANCE VERBOSE now show the locations of the Oracle alert log file and of the broker log file.
The configuration member to which a connection is made using the CONNECT command is now displayed upon successful completion of the command.
1. DG broker uses static listener service names to connect and start databases. Add static service names to listener.ora file in GI_HOME as grid user. On primary
6. At this point the DG broker configuration is complete. But it is good to check out the database status, inconsistent properties and validate the databases.
Changing Protection Mode to Maximum Availability
The current protection mode is maximum performance with redo transport mode set to ASYNC.
Oracle Data Guard on 12.2 CDB with Oracle Restart
Creating Data Guard Broker on 12c
Adding Far Sync Instances to Existing Data Guard Configuration
11gR2 RAC to RAC Data Guard
Data Guard Broker for 11gR2 RAC
11gR2 Standalone Data Guard (with ASM and Role Separation)
Setting Up Data Guard Broker for an Existing Data Guard Configuration with Far Sync
Enable Active Dataguard on 11gR2 RAC Standby
12.2 also introduced several new features. Below are few highlights from the DG broker guide.
To increase high availability, you can now set multiple fast-start failover targets and the broker automatically selects which one to use.
You can now start observers on multiple hosts to manage a single Data Guard broker configuration.
The new Data Guard broker property ApplyInstances can be used to engage multiinstance Redo Apply as well as to restrict the number of instances that are involved in redo apply on an Oracle Real Application Clusters (Oracle RAC) database.
The broker now supports migrating a pluggable database (PDB) from one multitenant container database (CDB) to another on the same host. You can migrate a PDB from a primary CDB to another primary CDB or failover a PDB from a standby CDB to a primary CDB.
The DGMGRL commands SHOW DATABASE VERBOSE and SHOW INSTANCE VERBOSE now show the locations of the Oracle alert log file and of the broker log file.
The configuration member to which a connection is made using the CONNECT command is now displayed upon successful completion of the command.
1. DG broker uses static listener service names to connect and start databases. Add static service names to listener.ora file in GI_HOME as grid user. On primary
SID_LIST_LISTENER =On standby
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = prodcdb)
(SID_NAME = prodcdb)
(ORACLE_HOME = /opt/app/oracle/product/12.2.0/dbhome_1)
)
(SID_DESC =
(GLOBAL_DBNAME = prodcdb_DGMGRL)
(SID_NAME = prodcdb)
(ORACLE_HOME = /opt/app/oracle/product/12.2.0/dbhome_1)
)
)
SID_LIST_LISTENER =Restart the listeners on both primary and standby and view static service registration. On primary
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = stbycdb)
(SID_NAME = stbycdb)
(ORACLE_HOME = /opt/app/oracle/product/12.2.0/dbhome_1)
)
(SID_DESC =
(GLOBAL_DBNAME = stbycdb_DGMGRL)
(SID_NAME = stbycdb)
(ORACLE_HOME = /opt/app/oracle/product/12.2.0/dbhome_1)
)
)
Service "prodcdb_DGMGRL" has 1 instance(s).On standby
Instance "prodcdb", status UNKNOWN, has 1 handler(s) for this service...
Service "stbycdb_DGMGRL" has 1 instance(s).2. As this is non-RAC database setup, the default locations are chosen for dg broker config files. If this was a RAC configuration then the dg broker config file location must be shared by all instances. On primary the dg broker config files location is shown below.
Instance "stbycdb", status UNKNOWN, has 1 handler(s) for this service...
NAME VALUEOn standby
------------------------------ ------------------------------------------------------------
dg_broker_config_file1 /opt/app/oracle/product/12.2.0/dbhome_1/dbs/dr1prodcdb.dat
dg_broker_config_file2 /opt/app/oracle/product/12.2.0/dbhome_1/dbs/dr2prodcdb.dat
NAME VALUE3. Set dg broker to auto start on both primary and standby
------------------------------ ------------------------------------------------------------
dg_broker_config_file1 /opt/app/oracle/product/12.2.0/dbhome_1/dbs/dr1stbycdb.dat
dg_broker_config_file2 /opt/app/oracle/product/12.2.0/dbhome_1/dbs/dr2stbycdb.dat
alter system set dg_broker_start=true scope=both sid='*';4. Create the DG broker configuration by adding the primary database.
$ dgmgrl /4. Add the standby database into the DG broker. Before adding the standby database, the LOG_ARCHIVE_DEST_n value used for redo transport must be cleared on on both primary and standby. Adding of the standby DB would fail without clearing the LOG_ARCHIVE_DEST_n value
Welcome to DGMGRL, type "help" for information.
Connected to "prodcdb"
Connected as SYSDG.
DGMGRL> create configuration dg12c2 as primary database is prodcdb connect identifier is prodcdbtns;
Configuration "dg12c2" created with primary database "prodcdb"
DGMGRL> show configuration
Configuration - dg12c2
Protection Mode: MaxPerformance
Members:
prodcdb - Primary database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
DGMGRL> add database stbycdb as connect identifier is stbytns;Reason for this has been explained in the previous 12cR1 dg broker post and MOS 1582179.1. Once log_archive_dest is cleared, standby DB addition works. In this DG setup, log_archive_dest_2 is used for redo transport. Reset it on both primary and standby
Error: ORA-16698: member has a LOG_ARCHIVE_DEST_n parameter with SERVICE attribute set
Failed.
SQL> alter system reset log_archive_dest_2 scope=both;Add the standby database
System altered.
DGMGRL> add database stbycdb as connect identifier is stbytns;5. Enable the configuration
Database "stbycdb" added
DGMGRL> show configuration
Configuration - dg12c2
Protection Mode: MaxPerformance
Members:
prodcdb - Primary database
stbycdb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration
Configuration - dg12c2
Protection Mode: MaxPerformance
Members:
prodcdb - Primary database
stbycdb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 168 seconds ago)
6. At this point the DG broker configuration is complete. But it is good to check out the database status, inconsistent properties and validate the databases.
DGMGRL> show database prodcdbIf the verbose option is used then as stated in new features section log files are shown
Database - prodcdb
Role: PRIMARY
Intended State: TRANSPORT-ON
Instance(s):
prodcdb
Database Status:
SUCCESS
DGMGRL> show database stbycdb
Database - stbycdb
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: 2.00 KByte/s
Real Time Query: OFF
Instance(s):
stbycdb
Database Status:
SUCCESS
DGMGRL> show database verbose prodcdbCheck inconsistent properties
...
Log file locations:
Alert log : /opt/app/oracle/diag/rdbms/prodcdb/prodcdb/trace/alert_prodcdb.log
Data Guard Broker log : /opt/app/oracle/diag/rdbms/prodcdb/prodcdb/trace/drcprodcdb.log
Database Status:
SUCCESS
DGMGRL> show database prodcdb inconsistentPropertiesValidate the databases
INCONSISTENT PROPERTIES
INSTANCE_NAME PROPERTY_NAME MEMORY_VALUE SPFILE_VALUE BROKER_VALUE
DGMGRL> show database stbycdb inconsistentProperties
INCONSISTENT PROPERTIES
INSTANCE_NAME PROPERTY_NAME MEMORY_VALUE SPFILE_VALUE BROKER_VALUE
DGMGRL> validate database prodcdb7. As part of the DG setup, if possible carry out a switchover to check if DG broker can bring up the databases without any issue.
Database Role: Primary database
Ready for Switchover: Yes
Managed by Clusterware:
prodcdb: YES
DGMGRL> validate database stbycdb
Database Role: Physical standby database
Primary Database: prodcdb
Ready for Switchover: Yes
Ready for Failover: Yes (Primary Running)
Managed by Clusterware:
prodcdb: YES
stbycdb: YES
DGMGRL> show configuration when primary is stbycdbConnect with password to dgmgrl and perform the switchover
Configuration when stbycdb is primary - dg12c2
Members:
stbycdb - Primary database
prodcdb - Physical standby database
$ dgmgrl sys/prodcdbdbOn the new primary (stbycdb) the PDBs will be in read write mode
DGMGRL> switchover to stbycdb;
Performing switchover NOW, please wait...
Operation requires a connection to database "stbycdb"
Connecting ...
Connected to "stbycdb"
Connected as SYSDBA.
New primary database "stbycdb" is opening...
Oracle Clusterware is restarting database "prodcdb" ...
Switchover succeeded, new primary is "stbycdb"
DGMGRL> show configuration
Configuration - dg12c2
Protection Mode: MaxPerformance
Members:
stbycdb - Primary database
prodcdb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 18 seconds ago)
SQL> show pdbsOn the new standby (prodcdb) PDBs will be in mount mode
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
5 PDBAPP1 READ WRITE NO
SQL> show pdbsSwitchover back to original primary
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED MOUNTED
5 PDBAPP1 MOUNTED
DGMGRL> switchover to prodcdbThis conclude the setting up of DG broker for an existing 12.2 data guard setup with CDB. Below is an additional step, showing how to increase the protection mode to maximum availability using DG Broker.
Performing switchover NOW, please wait...
Operation requires a connection to database "prodcdb"
Connecting ...
Connected to "prodcdb"
Connected as SYSDBA.
New primary database "prodcdb" is opening...
Oracle Clusterware is restarting database "stbycdb" ...
Switchover succeeded, new primary is "prodcdb"
Changing Protection Mode to Maximum Availability
The current protection mode is maximum performance with redo transport mode set to ASYNC.
DGMGRL> show configurationTo change the protection mode set the redo transport to SYNC and upgrade the protection mode
Configuration - dg12c2
Protection Mode: MaxPerformance
Members:
prodcdb - Primary database
stbycdb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL> show database prodcdb LogXptMode
LogXptMode = 'ASYNC'
DGMGRL> show database stbycdb LogXptMode
LogXptMode = 'ASYNC'
DGMGRL> edit database prodcdb set property LogXptMode='SYNC';Related Posts
Property "logxptmode" updated
DGMGRL> edit database stbycdb set property LogXptMode='SYNC';
Property "logxptmode" updated
DGMGRL> show database prodcdb LogXptMode
LogXptMode = 'SYNC'
DGMGRL> show database stbycdb LogXptMode
LogXptMode = 'SYNC'
DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MaxAvailability;
Succeeded.
DGMGRL> show configuration
Configuration - dg12c2
Protection Mode: MaxAvailability
Members:
prodcdb - Primary database
stbycdb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 29 seconds ago)
Oracle Data Guard on 12.2 CDB with Oracle Restart
Creating Data Guard Broker on 12c
Adding Far Sync Instances to Existing Data Guard Configuration
11gR2 RAC to RAC Data Guard
Data Guard Broker for 11gR2 RAC
11gR2 Standalone Data Guard (with ASM and Role Separation)
Setting Up Data Guard Broker for an Existing Data Guard Configuration with Far Sync
Enable Active Dataguard on 11gR2 RAC Standby