How Many SCAN Listeners?

Today we will explore little more about SCAN listeners. The common question comes in mind like: How many SCAN listeners could be configured in a multi-node RAC environment? , How many SCAN listeners would actually be required and how many would be enough? Etc.

Let’s find out the answers for these common queries.

I am assuming that by now most of DBAs are pretty comfortable with SCAN listeners; in case need detailed explanation then following URL would a good choice to visit here. As usual, awesome documentation from Oracle for SCAN in 11g as well as 12c releases.

Basically SCAN Listeners are introduced to create another connection handler on top of existing node listeners to overcome the failover and load balancing issues till 11gR1 architecture for RAC. Till 11gR1 Node listeners were defined on VIPs to facilitate NACK (Negative Acknowledgement) to resolve the issue of TCP timeouts.

Pre 11gR2 database environments, clients may take up to 2 minutes to decide (on TCP level) a node is down. This is purely because of the TCP Timeouts, which can differ from platform to platform. These 2 minutes are unacceptable, and it was a good thing of Oracle to understand and address this issue. Oracle designed a virtual IP address to be assigned to the public interface. Under normal circumstances, the VIP will be located to its designated NIC, and the listener will be bound to this VIP. Whenever there is a need to failover the VIP to another node in the cluster, when clients want to connect to this VIP (due to tns alias addresses pointing to this VIP), the VIP will immediately respond (because it has failed over and the TCP stack is running against it), and the client is able to get negative acknowledgement (NACK) confirming that no listener is active at its designated port. Within few seconds the client will know and fail over to the alternative address in its TNS alias. This makes failover a lot faster.

From 11gR2 onwards oracle enhanced the administration as well as availability of database from client’s perspective, load balancing etc by introducing SCAN (Single Client Access Name). With SCAN, clients could use SCAN-NAME (resolved by 3 VIPs, for default configuration) rather than list of all rac nodes in connect string. By default SCAN listeners (defined on SCAN VIPs) created as first point which co-ordinate with Node Listeners (defined on VIPs), so even if failure of node scan listener running on that node (if any) would be relocated to any surviving node while available SCAN listeners would be serving as normal.

In practice any complex environment designed with multi-tier architecture involving connection handling via connection pool mechanism. It reduces connectivity time for application or web based end users. Normally 3 SCANs are capable enough to handle hundreds of new connections in a span of few seconds. Still if you feel that default 3 SCAN listeners are not enough for your environment then you have an option to add few more scan listeners. GNS based dynamic IP scheme still has no way to change number of SCAN listeners in your environment. Today we will elaborate the process of adding one extra scan listener in our DNS based static IP configuration.

It could be done in following simple steps without affectivng the availability of cluster:

  1. Add additional unused IP from same subnet into DNS configuration for scan-name. pair
  2. Restart dns named service
  3. Update scan from cluster
  4. Update scan_listener from cluster
  5. Verify the changed configuration
  6. Start newly added scan
  7. Verify service registration on newly added listener_scan4 scan listener

Currently scan_name mask11gr2p-scan is resolved into pair of 3 IPs (192.168.2.211/212/213)

[root@maskdns ~]# nslookup mask11gr2p-scan

Server: 192.168.2.100

Address: 192.168.2.100#53

Name: mask11gr2p-scan.lgk.nmk

Address: 192.168.2.213

Name: mask11gr2p-scan.lgk.nmk

Address: 192.168.2.211

Name: mask11gr2p-scan.lgk.nmk

Address: 192.168.2.212

We have identified IP 192.168.2.220 from same subnet and added that against scan_name “mask11gr2p-scan.lgk.nmk”

[root@maskdns named]# grep -i 220 rev.lgk.nmk

220 IN PTR mask11gr2p-scan.lgk.nmk.

[root@maskdns named]# grep -i 220 for.lgk.nmk

mask11gr2p-scan.lgk.nmk. IN A 192.168.2.220

To reflect the changes we need to do restart of named service

[root@maskdns named]# service named restart

Stopping named: . [ OK ]

Starting named: [ OK ]

Now verify that scan name is getting resolved into 4 IPs:

[root@maskdns named]# nslookup mask11gr2p-scan

Server: 192.168.2.100

Address: 192.168.2.100#53

Name: mask11gr2p-scan.lgk.nmk

Address: 192.168.2.212

Name: mask11gr2p-scan.lgk.nmk

Address: 192.168.2.213

Name: mask11gr2p-scan.lgk.nmk

Address: 192.168.2.220

Name: mask11gr2p-scan.lgk.nmk

Address: 192.168.2.211

Check the current SCAN configuration to compare the pre-post changes

[root@mask11gr2p1.lgk.nmk] srvctl config scan

SCAN name: mask11gr2p-scan, Network: 1/192.168.2.0/255.255.255.0/eth0

SCAN VIP name: scan1, IP: /mask11gr2p-scan.lgk.nmk/192.168.2.211

SCAN VIP name: scan2, IP: /mask11gr2p-scan.lgk.nmk/192.168.2.212

SCAN VIP name: scan3, IP: /mask11gr2p-scan.lgk.nmk/192.168.2.213

Now login to database cluster with root and execute “srvctl modify scan –n < scan name>”

[root@mask11gr2p1.lgk.nmk] srvctl modify scan -n mask11gr2p-scan

Verify the configuration post change

[root@mask11gr2p1.lgk.nmk] srvctl config scan

SCAN name: mask11gr2p-scan, Network: 1/192.168.2.0/255.255.255.0/eth0

SCAN VIP name: scan1, IP: /mask11gr2p-scan.lgk.nmk/192.168.2.211

SCAN VIP name: scan2, IP: /mask11gr2p-scan.lgk.nmk/192.168.2.212

SCAN VIP name: scan3, IP: /mask11gr2p-scan.lgk.nmk/192.168.2.213

SCAN VIP name: scan4, IP: /mask11gr2p-scan.lgk.nmk/192.168.2.220

Check the current scan_listener configuration to compare the pre-post changes

[root@mask11gr2p1.lgk.nmk] 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

Now update the scan listener configuration by executing “srvctl modify scan_listener –u”

[root@mask11gr2p1.lgk.nmk] srvctl modify scan_listener -u

Verify the scan listener configuration post change

[root@mask11gr2p1.lgk.nmk] 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

SCAN Listener LISTENER_SCAN4 exists. Port: TCP:1521

Check the status of scan listener

[root@mask11gr2p1.lgk.nmk] srvctl status scan_listener

SCAN Listener LISTENER_SCAN1 is enabled

SCAN listener LISTENER_SCAN1 is running on node mask11gr2p2

SCAN Listener LISTENER_SCAN2 is enabled

SCAN listener LISTENER_SCAN2 is running on node mask11gr2p1

SCAN Listener LISTENER_SCAN3 is enabled

SCAN listener LISTENER_SCAN3 is running on node mask11gr2p1

SCAN Listener LISTENER_SCAN4 is enabled

SCAN listener LISTENER_SCAN4 is not running

Start the listener_scan4

[root@mask11gr2p1.lgk.nmk] srvctl start scan_listener -i 4

Check the status of scan listener

[root@mask11gr2p1.lgk.nmk] srvctl status scan_listener

SCAN Listener LISTENER_SCAN1 is enabled

SCAN listener LISTENER_SCAN1 is running on node mask11gr2p2

SCAN Listener LISTENER_SCAN2 is enabled

SCAN listener LISTENER_SCAN2 is running on node mask11gr2p1

SCAN Listener LISTENER_SCAN3 is enabled

SCAN listener LISTENER_SCAN3 is running on node mask11gr2p1

SCAN Listener LISTENER_SCAN4 is enabled

SCAN listener LISTENER_SCAN4 is running on node mask11gr2p2

We can see that services are able to get registered on 4th SCAN listener

[grid@@mask11gr2p1.lgk.nmk] lsnrctl status LISTENER_SCAN4

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 27-SEP-2013 15:24:01

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN4)))

STATUS of the LISTENER

————————

Alias LISTENER_SCAN4

Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date 25-AUG-2013 22:55:37

Uptime 01 days 11 hr. 28 min. 24 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/oracle/product/11.2.0.3/crs/network/admin/listener.ora

Listener Log File /u01/app/oracle/product/11.2.0.3/crs/log/diag/tnslsnr/mask11gr2p1/listener_scan4/alert/log.xml

Listening Endpoints Summary…

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN4)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.220)(PORT=1521)))

Services Summary…

Service “MASKPRMY.LGK.NMK” has 2 instance(s).

Instance “MASKPRMY1“, status READY, has 1 handler(s) for this service…

Instance “MASKPRMY2“, status READY, has 1 handler(s) for this service…

The command completed successfully

In coming discussions we will explore more about SCAN Listeners & Node listeners and how connection load balancing, failover working in oracle cluster environment !!

Check our other post about how to protect your listeners from man-in-middle attack (TNS Poison Attack) using COST & VNCR.

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of either the companies I have worked for or Oracle Corporation and its affiliates. The comments, views and opinions expressed by visitors on this blog are theirs alone and may not reflect mine. Whatever scenarios suggested under this blog were simulated only on demo environment, so it’s advisable to test those in test systems before pushing to your production environment.

Advertisements

8 Responses to How Many SCAN Listeners?

  1. Pingback: 11g R2 RAC :SCAN DEMYSTIFIED - ORACLE IN ACTION

  2. Hello Amit, what is the logic behind having 3 scan in 11g.?
    Although the final connection is made by node VIP.

    Why oracle recommends to hv only 3 scan listner.

    • Hi Manish,

      Thanks for your query.

      As far as I can think of this then is no technical reason behind that. Whenever Oracle recommending something which is used & tested on variety of environments and found stable for performance/scaleability/high availability.

      SCAN Listener would normally be into following chain during normal operation ( there might be something more which I am not able to guess at this time)

      Ready for service –> Busy (Received request from Client) –> Busy (Identifying least loaded node) –> Busy (Redirecting connection to local listener of least loaded node) –> Busy (Handing off address of that local listener to client) –> Ready for service

      So lets consider following points

      -> Having less than 2 SCAN listeners would be concern for HA.
      -> Having 2 SCAN listeners would be good for HA.
      -> For any processing in round robin we want to make sure that whenever we approaches someone we want that process so having only 2 SCAN listener would put me into situation when I am trying to approach SCAN which is not yet ready to check my request.
      -> So 2 SCANs would be good to go, still the formula of having N+1 , which means take one more than what you need for your system. Same is like we have with number of control files, though you should be good with two control files, still its better to have 2+1.
      -> So Having 2+1 would be good for both HA as well as scaleability.

      Last thing I would like to share that as per oracle 3 SCAN listeners would be sufficient enough to handle any peak load connection request even on largest cluster. Still if your environment is facing bottleneck then you have given an option to add more SCAN listeners.

      Regards,
      Amit S.

  3. anzo27 says:

    Hello everyone!
    here is my hosts file which I want to user to workaround the DNS server as I am installing the GI. please I need help to set up this file :

    127.0.0.1 localhost.localdomain localhost

    #————————- Public ——————————-
    192.168.71.101 ol7-122-rac1.localdomain ol7-122-rac1
    192.168.71.102 ol7-122-rac2.localdomain ol7-122-rac2

    #————————- Private ——————————-
    192.168.3.101 ol7-122-rac1-priv.localdomain ol7-122-rac1-priv
    192.168.3.102 ol7-122-rac2-priv.localdomain ol7-122-rac2-priv

    #————————- Virtual ——————————-
    192.168.71.103 ol7-122-rac1-vip.localdomain ol7-122-rac1-vip
    192.168.71.104 ol7-122-rac2-vip.localdomain ol7-122-rac2-vip

    #————————- SCAN —————————————–
    192.168.71.105 ol7-122-scan.localdomain ol7-122-scan
    192.168.71.106 ol7-122-scan.localdomain ol7-122-scan
    192.168.71.107 ol7-122-scan.localdomain ol7-122-scan

    As per the documents available on the net, you can configure RAC without actually using the DNS, please advise how to go about it.

  4. anzo27 says:

    extrat info:
    [root@odbrac1 ~]# systemctl restart named.service
    Job for named.service failed because the control process exited with error code. See “systemctl status named.service” and “journalctl -xe” for details.
    [root@odbrac1 ~]# systemctl status named.service
    ● named.service – Berkeley Internet Name Domain (DNS)
    Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor preset: disabled)
    Active: failed (Result: exit-code) since Sun 2017-04-02 01:04:56 EDT; 12s ago
    Process: 2600 ExecStartPre=/bin/bash -c if [ ! “$DISABLE_ZONE_CHECKING” == “yes” ]; then /usr/sbin/named-checkconf -z /etc/named.conf; else echo “Checking of zone files is disabled”; fi (code=exited, status=1/FAILURE)

    Apr 02 01:04:56 odbrac1.racbuild bash[2600]: in-addr.arpa:2: no TTL specified; using SO…ad
    Apr 02 01:04:56 odbrac1.racbuild bash[2600]: dns_rdata_fromtext: in-addr.arpa:19: near …s)
    Apr 02 01:04:56 odbrac1.racbuild bash[2600]: in-addr.arpa:20: unknown RR type ‘/var/nam…a’
    Apr 02 01:04:56 odbrac1.racbuild bash[2600]: zone in-addr.arpa/IN: loading from master …pe
    Apr 02 01:04:56 odbrac1.racbuild bash[2600]: zone in-addr.arpa/IN: not loaded due to errors.
    Apr 02 01:04:56 odbrac1.racbuild bash[2600]: _default/in-addr.arpa/IN: unknown class/type
    Apr 02 01:04:56 odbrac1.racbuild systemd[1]: named.service: control process exited, cod…=1
    Apr 02 01:04:56 odbrac1.racbuild systemd[1]: Failed to start Berkeley Internet Name Dom…).
    Apr 02 01:04:56 odbrac1.racbuild systemd[1]: Unit named.service entered failed state.
    Apr 02 01:04:56 odbrac1.racbuild systemd[1]: named.service failed.
    Hint: Some lines were ellipsized, use -l to show in full.
    [root@odbrac1 ~]#

Share Your Comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Pierre blog

Pierre Forstmann Oracle Database blog

flashdba

Oracle databases, storage and the high-performance world of flash memory

Future Veterans

Ramblings about Oracle

Ranjeet Srivastava

Smile! You’re at the best blog ever

Kevin Closson's Blog: Platforms, Databases and Storage

Platform, Database and Storage Topics

Real Life Database / SQL Experiences : An Oracle Blog from Vivek Sharma

Being an Oracle Professional, I like to share all my Real Life Performance Tuning Challenges and Experiences. The Content and Views on this site are my own and not necessarily those of Oracle. While, I write on my real life experiences, the resolutions mentioned are solely mine. Comments / Criticisms are always a welcome.

Frits Hoogland Weblog

IT Technology; Oracle, linux, TCP/IP and other stuff I find interesting

OraStory

Dominic Brooks on Oracle Performance, Tuning, Data Quality & Sensible Design ... (Now with added Sets Appeal)

ASM Support Guy

Just Another Crazy Oracle DBA

Exadata Certification

Just Another Crazy Oracle DBA

Carlos Sierra's Tools and Tips

Tools and Tips for Oracle Performance and SQL Tuning

Sangram keshari's Oracle Blog

The Fusion Middleware Administration & Database Administration Blog

Amit Saraswat

Just Another Crazy Oracle DBA

Oracle Scratchpad

Just another Oracle weblog

The Tom Kyte Blog

Just Another Crazy Oracle DBA

Hemant's Oracle DBA Blog

Just Another Crazy Oracle DBA

Uwe Hesse

about Database Technology

Richard Foote's Oracle Blog

Focusing Specifically On Oracle Indexes, Database Administration and Some Great Music

%d bloggers like this: