Saturday, March 31, 2018

Oracle RAC Scan Listener - (2)



To get scan name details:
These commands will have to executed by grid user.



bash-4.3$ srvctl config scan
SCAN name: SMDCMBDBL, Network: 1/XX.XX.10.0/255.255.255.0/nxge7
SCAN VIP name: scan1, IP: /xx.xx.xx.106/10.54.10.106
SCAN VIP name: scan2, IP: /xx.xx.xx.108/10.54.10.108
SCAN VIP name: scan3, IP: /xx.xx.xx.107/10.54.10.107


bash-4.3$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521


To get the status of the scan listener:


bash-4.3$ srvctl status  scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node kdbpprp2
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node kdbpprp1
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node kdbpprp1


The above command shows the hostname on which the 3 different scan listeners are running.


DNS performs the initial load balancing while scan name is called. As 3 IPs are assigned with the
scan name initially though that can be extended later. While clients send request to DNS, DNS
provided three different IP on different request. I.e while we are trying to fetch the DNS with
scan name, we get IP addresses order in different order.


paul@DBBL-ITDD-PAUL:~$ nslookup kdbpprp
Server: 127.0.1.1
Address: 127.0.1.1#53

Name: kdbpprp.dutchbanglabank.com
Address: XX.XX.XXX.162
Name: kdbpprp.dutchbanglabank.com
Address: XX.XX.XXX.161
Name: kdbpprp.dutchbanglabank.com
Address: XX.XX.XXX.163

paul@DBBL-ITDD-PAUL:~$ nslookup kdbpprp
Server: 127.0.1.1
Address: 127.0.1.1#53

Name: kdbpprp.dutchbanglabank.com
Address: XX.XX.XXX.161
Name: kdbpprp.dutchbanglabank.com
Address: XX.XX.XXX.163
Name: kdbpprp.dutchbanglabank.com
Address: XX.XX.XXX.162

paul@DBBL-ITDD-PAUL:~$ nslookup kdbpprp
Server: 127.0.1.1
Address: 127.0.1.1#53

Name: kdbpprp.dutchbanglabank.com
Address: XX.XX.XXX.163
Name: kdbpprp.dutchbanglabank.com
Address: XX.XX.XXX.162
Name: kdbpprp.dutchbanglabank.com
Address: XX.XX.XXX.161

paul@DBBL-ITDD-PAUL:~$



Command to get status for the specific listener scan.
bash-4.3$ lsnrctl  status LISTENER_SCAN2

LSNRCTL for HPUX: Version 11.2.0.4.0 - Production on 29-MAR-2018 14:50:55

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN2
Version                   TNSLSNR for HPUX: Version 11.2.0.4.0 - Production
Start Date                24-OCT-2017 17:57:55
Uptime                    155 days 20 hr. 52 min. 59 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /orafs/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /orafs/app/11.2.0/grid/log/diag/tnslsnr/kdbpprp1/listener_scan2/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN2)))
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XX.XX.XXX.163)(PORT=1521)))
Services Summary...
Service "agentdb" has 2 instance(s).
 Instance "agentdb11", status READY, has 1 handler(s) for this service...
 Instance "agentdb12", status READY, has 1 handler(s) for this service...
Service "agentdb1XDB" has 2 instance(s).
 Instance "agentdb11", status READY, has 1 handler(s) for this service...
 Instance "agentdb12", status READY, has 1 handler(s) for this service...
The command completed successfully



Node VIP: Each Database node in Real Application cluster environment has one node IP and one Node VIP
address, The main difference between these two is Node VIP can move to any other system in case
if current owning system is down but Node IP can't do that. When ever a new connection request is made
the SCAN listener listening on a SCAN IP address and the SCAN port is contracted on a client's behalf.
Because all services on the cluster are registered with the SCAN listener, the SCAN listener replies with the
address of the local listener as Node VIP address on the least-loaded node (Each scan listener keeps updated
cluster load statistics) and connection is routed to that node.


Local Listener on the Database server is registered with Node VIP and Node IP address.


bash-4.3$ lsnrctl status listener

LSNRCTL for HPUX: Version 11.2.0.4.0 - Production on 29-MAR-2018 14:59:48

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for HPUX: Version 11.2.0.4.0 - Production
Start Date                24-OCT-2017 18:06:15
Uptime                    155 days 20 hr. 53 min. 33 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /orafs/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /orafs/app/grid/diag/tnslsnr/kdbpprp1/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XX.XX.XXX.61)(PORT=1521)))
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XX.XX.XXX.60)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
 Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "agentdb" has 1 instance(s).
 Instance "agentdb11", status READY, has 1 handler(s) for this service...
Service "agentdb1XDB" has 1 instance(s).
 Instance "agentdb11", status READY, has 1 handler(s) for this service...
The command completed successfully


Local_Listener: This is a database parameter which is used to provide detail of local listener running on
database node itself. In Real Application Cluster environment this has Node VIP address as value.


When a new connection request is made my SCAN Listener, This address is returned to the SCAN Listener and
then connection is made to database local listener. The difference between SCAN Listener and Local Listener
is SCAN listener runs corosponding to SCAN VIP's while Local Listener runs with Node VIP or Node IP address.
SCAN Listener can move to another database node in case of node failure but local Listener doesn't have this
kind of behavior.


SQL> show parameter local_listener

NAME                                 TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string (ADDRESS=(PROTOCOL=TCP)(HOST=XX.XX.XXX.60)(PORT=1521))


Remote_Listener: Each database instance has this parameter set to SCAN NAME of the cluster environment.
SCAN NAME in turn has one or more IP address further called SCAN VIP and each SCAN VIP has SCAN Listener
running on it, so finally each database instance register itself with all SCAN Listeners running across the
clusterware.


SQL> show parameter remote_listener

NAME                                 TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_listener                      string kdbpprp:1521



The solo purpose of remote_listener parameter is to register each database instance with all SCAN Listeners
in RAC. This provide information on what services are being provided by the instance,the current load, and a
recommendation on how many incoming connections should be directed to the instance.


Stopping scan listener:
srvctl stop scan_listener [-scannumber ordinal_number] [-force]

Example:
srvctl stop scan_listener -scannumber 1


Relocate scan listener:
bash-4.3$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node kdbpbrp2
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running on node kdbpbrp1
SCAN VIP scan3 is enabled

SCAN VIP scan3 is running on node kdbpbrp1

srvctl relocate scan -i -n  

Example:
srvctl relocate scan -i 3 -n kdbpbrp2

bash-4.3$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node kdbpbrp2
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running on node kdbpbrp1
SCAN VIP scan3 is enabled

SCAN VIP scan3 is running on node kdbpbrp2



No comments: