Oracle Data Guard In A Cloud - Part V
I am your Broker, trust me!
In previous article we configured the secondary server for an active data guard. At this point we have a working physical standby database.
Now, let's configure Oracle Data Guard Broker.
Few words about Broker...
The Oracle Data Guard broker is a distributed management framework that automates and centralizes the creation, maintenance, and monitoring of Data Guard configurations.
You can perform all management operations locally or remotely through the broker's easy-to-use interfaces: the Data Guard management pages in Oracle Enterprise Manager, which is the broker's graphical user interface (GUI), and the Data Guard command-line interface called DGMGRL.
In this article we will focus on using DGMGRL. You can say I am biased here, but there are few reasons to go with the command line interface. It is plain and simple. No complexities, no links to click, no interface to deal with and command line tools work right out of the box.
I know you want to learn about configuring the Data Guard Broker. I did not want to start configuring the broker without providing a short introduction of the broker. I highly recommend you read through Oracle docs for detailed information on the broker.
Configure Listener with static service
We need to add a DGMGRL service to the listener file on the primary as well as standby database(s). So, let's start with the primary server.
Find the listener file under grid home and open the file in a vi editor.
[oracle@primary_server ora_scripts] cd ORACLE_HOME/grid
[oracle@primary_server grid] cd network/admin
[oracle@primary_server admin] vi listener.ora
We will register a static service for DGMGRL.
(SID_DESC=
(GLOBAL_DBNAME = cssdev_dgmgrl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = cssdev)
)
Your entire listener file should look like below.
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME = cssdev)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = cssdev)
)
(SID_DESC=
(GLOBAL_DBNAME = cssdev_dgmgrl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = cssdev)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
Make sure you to test changes made to the listener file. If you followed previous articles in this series then you must know how to run listener test. Next, let's modify listener for the standby server.
Find the listener file under grid home on the standby server and open the file in a vi editor.
(SID_DESC =
(GLOBAL_DBNAME = cssdg1_dgmgrl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = cssdev)
)
Above is the snippet we will add to the listener file. Your entire listener file should look like below.
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = cssdg1)
(SID_NAME = cssdev)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
)
(SID_DESC =
(GLOBAL_DBNAME = cssdg1_dgmgrl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = cssdev)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
Again, test the listener after making these modifications.
Meet DGMGRL CLI
DGMGRL is located under $ORACLE_HOME/bin directory. Before we use DGMGRL let's turn on data guard broker on primary and secondary servers.
Go to SQL prompt on the primary server.
[oracle@primary_server ora_scripts] ./sqlplus.sh
/*start broker*/
SQL > alter system set dg_broker_start = true;
/*verify broker*/
SQL > show parameter dg_broker_start;
Short exercise for you: Go and turn on the data guard broker on the secondary server.
We will run DGMGRL on the physical standby server, which is our secondary server. Run dgmgrl.sh to invoke DGMGRL command line interface. At the DGMGRL prompt connect to the primary database.
[oracle@standby_server ora_scripts] ./dgmgrl.sh
/*DGMGRL command line interface */
DGMGRL >
/*connect to primary database*/
DGMGRL > connect sys/yourpassword@cssdev;
Broker Configuration File
Next we will create a configuration file to manage our data guard environment. While at DGMGRL prompt, run following commands to create a configuration file.
/*create a configuration file*/
DGMGRL > create configuration ‘drsolution’ as primary database is ‘cssdev’ connect identifier is ‘cssdev’;
/*check configuration*/
DGMGRL > show configuration;
if all went well, then you should see primary database listed in the configuration.
Add Standby database
While at DGMGRL prompt, add standby database and view the configuration again.
/*add standby database*/
DGMGRL > add database ‘cssdg1’ as connect identifier is ‘cssdg1’;
/*check configuration*/
DGMGRL > show configuration;
Now you should see primary as well as standby database in the configuration.
Switch Me Over
Now let's use DGMGRL to test the switchovers. Of course you can manually perform switchovers or script it out with SQL commands, but our goal here is to configure Data Guard Broker and then use DGMGRL to manage the data guard environment, right?
You should still be at DGMGRL prompt.
/*perform a switchover to standby*/
DGMGRL > switchover to ‘cssdg1’;
DGMGRL will invoke a switchover and you should see something like below at the command line.
Performing switchover NOW, please wait...
New primary database "cssdg1" is opening...
Operation requires shutdown of instance "cssdev" on database "cssdev"
Shutting down instance "cssdev"...
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "cssdev" on database "cssdev"
Starting instance "cssdev"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "cssdg1"
Voila! We have successfully switched over to physical standby. In other words our physical standby is now primary server and original primary server is a physical standby. Very exciting stuff.
Here is an exercise for you: Perform a switchover to move back to original primary, can you do it? Sure you can.
When you ran "show configuration" on the DGMGRL prompt did you notice "Fast-Start Failover": DISABLED? I am sure you did. Well, here is the good news. In the next article we will configure Oracle Data Guard Observer and turn on the Fast Start Failover.
See you then!
Hi, I am Ritesh Patel. I live in a beautiful town surrounded by the mountains. C&O Canal is few miles away. State parks are only a distance away & bike trails galore. It is home sweet home Frederick, MD. A passionate developer. Love to cook. Enjoy playing "Bollywood Tunes" on my harmonica. Apart from that just a normal guy.