How to add a Second listener on a Second Network to a 12c RAC Cluster
Contents
Overview
Recently, I had a need to create a dedicated backup network for a backup tool. The backup tool needed to know about each node in the cluster and wanted to connect to the nodes individually on a separate network.The following page details how I achieved this by creating a second listener to a 12c RAC Cluster. In this particular instance, the second listener will be used to support backup operations which will run on a separate and dedicated network. This network is segregated from the other networks used by the cluster to help ensure the backup traffic does not interfere with application traffic.
For this example the following conventions will be used
- The second listener will be called LISTENER_BACKUP.
- The second network will have a NETNUM of 2.
- The host names will be myrac1, myrac2 and myrac3.
- The database will be called mydbrac00
- The three instances will be called myracdb01, myracdb02 and myracdb03
- A bond will be used that maps to Network Interface Card eth0 and eth1
- A database service will be used for the backup called APPBKP_PRD
- The IP that the default listener is configured on for myrac1 will be 172.22.52.21
- The IP that the default listener is configured on for myrac2 will be 172.22.52.22
- The IP that the default listener is configured on for myrac3 will be 172.22.52.23
Prerequisites
The following additional resources will need to be added to the RAC cluster- A bond on each node mapped to eth0 and eth1 (Optional if redundancy is not required)
- A DNS entry on myrac1 configured to bond0 called myrac1-backup
- A DNS entry on myrac2 configured to bond0 called myrac2-backup
- A DNS entry on myrac3 configured to bond0 called myrac3-backup
- A DNS entry for the backup vip on myrac1 called myrac1-backup-vip
- A DNS entry for the backup vip on myrac2 called myrac2-backup-vip
- A DNS entry for the backup vip on myrac3 called myrac3-backup-vip
Step-by-Step
1. Add the DNS entries to /etc/hosts2. Check the bond configuration
- On myrac1 add
- 172.22.18.84 myrac1-backup.mydomain.com myrac1-backup
- 172.22.18.85 myrac1-backup-vip.mydomain.com myrac1-backup-vip
- 172.22.18.86 myrac2-backup.mydomain.com myrac2-backup
- 172.22.18.87 myrac2-backup-vip.mydomain.com myrac2-backup-vip
- 172.22.18.88 myrac3-backup.mydomain.com myrac3-backup
- 172.22.18.89 myrac4-backup-vip.mydomain.com myrac3-backup-vip
- On myrac2 add
- 172.22.18.84 myrac1-backup.mydomain.com myrac1-backup
- 172.22.18.85 myrac1-backup-vip.mydomain.com myrac1-backup-vip
- 172.22.18.86 myrac2-backup.mydomain.com myrac2-backup
- 172.22.18.87 myrac2-backup-vip.mydomain.com myrac2-backup-vip
- 172.22.18.88 myrac3-backup.mydomain.com myrac3-backup
- 172.22.18.89 myrac4-backup-vip.mydomain.com myrac3-backup-vip
- On myrac3 add
- 172.22.18.84 myrac1-backup.mydomain.com myrac1-backup
- 172.22.18.85 myrac1-backup-vip.mydomain.com myrac1-backup-vip
- 172.22.18.86 myrac2-backup.mydomain.com myrac2-backup
- 172.22.18.87 myrac2-backup-vip.mydomain.com myrac2-backup-vip
- 172.22.18.88 myrac3-backup.mydomain.com myrac3-backup
- 172.22.18.89 myrac4-backup-vip.mydomain.com myrac3-backup-vip
3. Add the second network to the RAC cluster
- /sbin/ifconfig
- Make a note of the Mask it will be need further down
4. Add the VIPs to each node in the cluster
- Log on as root
- /u01/app/12.1.0/grid/bin/srvctl add network -netnum 2 -subnet 172.22.18.0/255.255.255.0/bond0 -nettype static -verbose
- NOTE - Under 12c, the network resource cannot be started. It will be started automatically when the VIPs are started.
5. Start the VIPs
- Log on as root
- /u01/app/12.1.0/grid/bin/srvctl add vip -node myrac1 -netnum 2 -address 172.22.18.85/255.255.255.0/bond0
- /u01/app/12.1.0/grid/bin/srvctl add vip -node myrac2 -netnum 2 -address 172.22.18.87/255.255.255.0/bond0
- /u01/app/12.1.0/grid/bin/srvctl add vip -node myrac3 -netnum 2 -address 172.22.18.89/255.255.255.0/bond0
- NOTE - Under 12c, the VIPs get a default name based on the server name. I have not found a way to change them.
6. Add the new listener
- Log on as root
- /u01/app/12.1.0/grid/bin/srvctl start vip -vip myrac1_2
- /u01/app/12.1.0/grid/bin/srvctl start vip -vip myrac2_2
- /u01/app/12.1.0/grid/bin/srvctl start vip -vip myrac3_2
7. Add the LISTENER_NETWORK alias to the tnsnames.ora file on each node.
- Log on as root
- /u01/app/12.1.0/grid/bin/srvctl add listener -listener LISTENER_BACKUP -netnum 2 -user oracle -endpoints TCP:1621
On node 1 add8. Tell the database about the new listener
LISTENER_BACKUP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.85)(PORT = 1621))
)
REMOTE_BACKUP =
(DESCRIPTION_LIST =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.85)(PORT = 1621)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.87)(PORT = 1621)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.89)(PORT = 1621)))
)
On node 2 add
LISTENER_BACKUP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.87)(PORT = 1621))
)
REMOTE_BACKUP =
(DESCRIPTION_LIST =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.85)(PORT = 1621)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.87)(PORT = 1621)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.89)(PORT = 1621)))
)
On node 3 add
LISTENER_BACKUP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.89)(PORT = 1621))
)
REMOTE_BACKUP =
(DESCRIPTION_LIST =
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.85)(PORT = 1621)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.87)(PORT = 1621)))
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.18.89)(PORT = 1621)))
)
9. Create an oracle sub directory under the TNS_ADMIN
- Log on as Oracle
- . oraenv
- ORACLE_SID = [oracle] ? myracdb01
- alter system set LISTENER_NETWORKS='((NAME=network2)(LOCAL_LISTENER_backup)(REMOTE_LISTENER=remote_backup))' scope=both sid='*';
- alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.22.52.21)(PORT=1521))' scope=both sid='MYRACDB01';
- alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.22.52.22)(PORT=1521))' scope=both sid='MYRACDB02';
- alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.22.52.23)(PORT=1521))' scope=both sid='MYRACDB03';
- alter system set remote_listener=' a-apvp1-scan-p.mydomain.com:1521' scope=both sid='*';
NOTE
- Log on as Oracle
- cd $TNS_ADMIN
- mkdir oracle
The sub directory is required to store a new listener.ora file for the second listener. Without it the second listener will not start. Just the directory is required. The listener.ora file will be created automatically by Oracle. At the time of putting this guide together I am not sure if this is a 12c feature or some oddity with the set-up I am using. It may have always behaved like this in previous versions of Oracle and I have just not seen it. Please get in touch if you know!!
10. Start the listener
11. Add a service for the backup running on the new network
- Log on as Oracle
- srvctl start listener -listener LISTENER_BACKUP
12. Add the following entries to the tnsnames.ora for the backup service
- srvctl add service -database MYRACDB00 -service APPBKP_PRD -netnum 2 -preferred MYRACDB01,MYRACDB02,MYRACDB03 -role PRIMARY -failovermethod BASIC -failovertype SELECT -failoverdelay 1 -failoverretry 180
- srvctl start service -d MYRACDB00 -s APPBKP_PRD
APPBKPN1_PRD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myrac1-backup-vip.mydomain.com)(PORT = 1621))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = APPBKP_PRD)
)
)
APPBKPN2_PRD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myrac2-backup-vip.mydomain.com)(PORT = 1621))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = APPBKP_PRD)
)
)
APPBKPN3_PRD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myrac3-backup-vip.mydomain.com)(PORT = 1621))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = APPBKP_PRD)
)
)