Before understanding the local and remote listener concept we’ve to go back to the basics and need to understand how the connection is made when the request sent a request to the database. So, in oracle RAC, local and remote listener plays a crucial role while creating a connection with the database in addition to maintain the load balancing so that no instance across the cluster will be overloaded.
When the user sends a request the scan will be the first
point of contact that receive the user’s request and it also works in a round
robin fashion and on the basis of load balancing advisory that each and every
node updates each other through private network using the PMON background
process it sends the request to the vip listener of the least loaded instance
and after that the vip of that specific node sends the request to the local
listener of that node. So, VIP and scan both of them play an important role and
in the absence of any one of them the connection can be made but the load
balancing may not achieve.
How the scan listener works
Remote listener is the
parameter that contain the scan name of the cluster and on the basis of that it
receives and reroute the connection’s request to the respective VIP.
SQL> show parameter
remote_listener
NAME TYPE
VALUE
------------------------------------
----------- ------------------------------
remote_listener string
oratest-scan
How To validate local
listener
Local listener contains
the vip information and each and every node has its own VIP address and that
vip address sends the request to local listener of that node.
NODE 1
SQL> show parameter
local_listener
NAME TYPE
VALUE
------------------------------------
----------- ------------------------------
local_listener
string
(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.41)(PORT=1521))
NODE 2
SQL> show parameter
local_listener
NAME TYPE
VALUE
------------------------------------
----------- ------------------------------
local_listener
string
(ADDRESS=(PROTOCOL=TCP)(HOST=1
92.168.1.40)(PORT=1521))
Validate VIP status
[oracle@oratest2 ~]$
srvctl status nodeapps
VIP 192.168.1.40 is
enabled
VIP 192.168.1.40 is
running on node: oratest1
VIP 192.168.1.41 is
enabled
VIP 192.168.1.41 is
running on node: oratest2
Network is enabled
Network is running on
node: oratest2
Network is running on
node: oratest1
ONS is enabled
ONS daemon is running on
node: oratest2
ONS daemon is running on
node: oratest1
[oracle@oratest2 ~]$
srvctl config nodeapps
Network 1 exists
Subnet IPv4:
192.168.1.0/255.255.255.0/enp0s3, static
Subnet IPv6:
Ping Targets:
Network is enabled
Network is individually
enabled on nodes:
Network is individually
disabled on nodes:
VIP exists: network number
1, hosting node oratest1
VIP Name: oratest1-vip
VIP IPv4 Address:
192.168.1.40
VIP IPv6 Address:
VIP is enabled.
VIP is individually
enabled on nodes:
VIP is individually
disabled on nodes:
VIP exists: network number
1, hosting node oratest2
VIP Name: oratest2-vip
VIP IPv4 Address:
192.168.1.41
VIP IPv6 Address:
VIP is enabled.
VIP is individually
enabled on nodes:
VIP is individually
disabled on nodes:
ONS exists: Local port
6100, remote port 6200, EM port 2016, Uses SSL true
ONS is enabled
ONS is individually
enabled on nodes:
ONS is individually
disabled on nodes:
Validate scan configuration
[oracle@oratest2 ~]$
srvctl config scan
SCAN name: oratest-scan,
Network: 1
Subnet IPv4:
192.168.1.0/255.255.255.0/enp0s3, static
Subnet IPv6:
SCAN 1 IPv4 VIP:
192.168.1.100
SCAN VIP is enabled.
SCAN 2 IPv4 VIP:
192.168.1.101
SCAN VIP is enabled.
SCAN 3 IPv4 VIP:
192.168.1.102
SCAN VIP is enabled.
Validate
Scan working in round robin or not
[oracle@oratest2 ~]$
nslookup oratest-scan
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: oratest-scan.localdomain
Address: 192.168.1.102
Name: oratest-scan.localdomain
Address: 192.168.1.100
Name: oratest-scan.localdomain
Address: 192.168.1.101
Name: oratest-scan.localdomain
Address: 192.168.1.102
Name: oratest-scan.localdomain
Address: 192.168.1.100
Name: oratest-scan.localdomain
Address: 192.168.1.101
[oracle@oratest2 ~]$
nslookup oratest-scan
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: oratest-scan.localdomain
Address: 192.168.1.100
Name: oratest-scan.localdomain
Address: 192.168.1.101
Name: oratest-scan.localdomain
Address: 192.168.1.102
Name: oratest-scan.localdomain
Address: 192.168.1.100
Name: oratest-scan.localdomain
Address: 192.168.1.101
Name: oratest-scan.localdomain
Address: 192.168.1.102
[oracle@oratest2 ~]$ nslookup oratest-scan
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: oratest-scan.localdomain
Address: 192.168.1.101
Name: oratest-scan.localdomain
Address: 192.168.1.102
Name: oratest-scan.localdomain
Address: 192.168.1.100
Name: oratest-scan.localdomain
Address: 192.168.1.101
Name: oratest-scan.localdomain
Address: 192.168.1.102
Name: oratest-scan.localdomain
Address: 192.168.1.100
[oracle@oratest2 ~]$
srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running
on node oratest2
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running
on node oratest1
SCAN VIP scan3 is enabled
SCAN VIP scan3 is running
on node oratest1
[oracle@oratest2 ~]$ srvctl status scan_listener
SCAN Listener
LISTENER_SCAN1 is enabled
SCAN listener
LISTENER_SCAN1 is running on node oratest2
SCAN Listener
LISTENER_SCAN2 is enabled
SCAN listener
LISTENER_SCAN2 is running on node oratest1
SCAN Listener
LISTENER_SCAN3 is enabled
SCAN listener
LISTENER_SCAN3 is running on node oratest1