How does SCAN listener works in Oracle RAC 11gR2?

Understanding SCAN listener functionality has become tough to Oracle DBA’s because of multi layered listeners introduced in Oracle 11gR2 RAC. I have met an Oracle DBA with almost 4 years of experience and working actively on RAC setup for 1 year but lack of knowledge on how SCAN listener works. People often get confused as listeners on VIP addresses which existed prior to 11R2 are still available. This blog will focus in explaining the concepts involved in and around SCAN listener.

Terminologies:

  • Let us understand the components related to SCAN individually and then relate them together to understand SCAN in COMPLETE.

SCAN VIP:

SCAN VIP is one of the resources you find in the output of “crsctl status resource –t” command. Number of SCAN VIP’s you notice will be the same as the number of SCAN LISTENERS in the setup.

SCAN VIP’s are physical IP addresses that you allocate to SCAN listeners. In the example that I use later in this blog, 192.168.122.5, 192.168.122.6, 192.168.122.7 are SCAN VIP’s. If you identify that SCAN VIP’s are online in the output of “crsctl status resource –t” command then IP addresses are online on the physical network ports. Only when SCAN VIP’s are online we can start the SCAN listeners.

 

SCAN LISTENER:

SCAN Listener is the oracle component which starts running a service on the port (by default its 1521) using the SCAN VIP (IP address). So SCAN listener doesn’t start if SCAN VIP is not online. This is the major difference between a SCAN listener and SCAN VIP. The number of SCAN listeners you notice in the output will be the same as number of SCAN VIP’s ONLINE. Name that is given to SCAN LISTENER is referred as SCAN NAME and it is registered in DNS server. In our example which you will find next, the SCAN name is “SCAN_LISTENER”.

So in short, always SCAN LISTENER and SCAN VIP are related to each other.

 

Node VIP:

Node VIP is the IP address which has capability of relocating to local listener of other node when the current node goes down. Drawback of using only node VIP is TNS entry of application server should have all node VIP addresses updated. You can identify the IP address assigned to node VIP will be a part of LOCAL listener. Test it yourself, run “lsnrctl status” on every node and you will find that local listener has two IP addresses – 1 node IP and 2 node VIP.

The challenge of having multiple VIP addresses in TNS entry is addressed in 11gR2 introducing SCAN.

 

  • Let us now understand the architecture of SCAN with the help of below image that serves the user requests from application server.
    Untitled_567

Assumptions:

  • 4 Node RAC setup
  • 3 SCAN listeners
  • DNS server in use
  • TNS of application uses SCAN_LISTENER as hostname
  • Database is new and no connections

Explanation for each stage numbered in the image:

  1. 0 sec: User1 when tries to establish a session on database with connection request C1, it hits DNS server first.
  2. DNS server will then resolve the name “SCAN_LISTENER” to the first IP 192.168.122.5
  3. C1 request reaches the first scan listener SCAN1 mostly the default name will be “LISTENER_SCAN1” which is running on 192.168.122.5 SCAN VIP.
  4. SCAN1 using details from LBA, identifies the load on each node in the setup and routes the request C1 to node which has least load.
  5. In this case it happened to be NODE 2 with least load or no load and the C1 request is addressed by local listener on this node which helps C1 to establish a session on instance on NODE 2.
  6. 5th sec: User2 when tries to establish a session on database with connection request C2, it hits DNS serer first.
  7. DNS server will now use Round-Robin algorithm and resolves the name “SCAN_LISTENER” to second IP 192.168.122.6
  8. C2 request reaches the second scan listener SCAN2 mostly the default name will be “LISTENER_SCAN2” which is running on 192.168.122.6 SCAN VIP.
  9. SCAN2 using details from LBA, identifies the load on each node in the setup and routes the request C2 to node which has least load.
  10. In this case it happened to be NODE 1 with least load or no load and the C2 request is addressed by local listener on this node which helps C2 to establish a session on instance on NODE 1.

— The same cycle and principles are applicable for other 3 connection requests C3, C4 and C5 —

Related Posts

About The Author

36 Comments

  1. guruvareddybolla.dba@gmail.com'
    BOLLA
    December 9, 2015
  2. ankit_chanpuria@yahoo.co.in'
    Ankit Chanpuria
    March 10, 2016
    • Pawan Kumar Yaddanapudi
      March 10, 2016
  3. mca.anil.ocp@gmail.com'
    Anil Bhardwaj
    March 21, 2016
  4. srikanthch.dba@gmail.com'
    srikanth reddy
    May 5, 2016
    • Pawan Kumar Yaddanapudi
      May 5, 2016
  5. yuvaraj.karthik@gmail.com'
    Yuvaraj
    June 2, 2016
  6. rajkumar.softalent@gmail.com'
    Raj Kumar
    June 2, 2016
    • Pawan Kumar Yaddanapudi
      June 3, 2016
    • jlallemand@gmail.com'
      Jorge Lallemand
      June 9, 2016
  7. dba99rakesh@gmail.com'
    Rakesh
    July 6, 2016
    • Pawan Kumar Yaddanapudi
      July 7, 2016
  8. snaik_44@yahoo.com'
    sanjay
    July 19, 2016
    • Pawan Kumar Yaddanapudi
      July 22, 2016
  9. murali_coder@yahoo.com'
    Bala.S
    July 21, 2016
    • pmsharmadba@gmail.com'
      Mallikarjuna Sharma
      August 5, 2016
  10. mjabdba@gmail.com'
    Mohammed
    August 7, 2016
  11. vmvineesh222@gmail.com'
    Vineesh
    August 29, 2016
    • Pawan Kumar Yaddanapudi
      August 29, 2016
  12. adammulla72@gmail.com'
    ADAM MULLA
    September 4, 2016
  13. karthiksupreme1986@gmail.com'
    karthik
    September 14, 2016
    • Pawan Kumar Yaddanapudi
      September 14, 2016
  14. dilliraj.maharjan@gmail.com'
    Dilli R. Maharjan
    September 21, 2016
    • Pawan Kumar Yaddanapudi
      October 25, 2016
  15. jayakishore.udayagiri@gmail.com'
    Kishore
    October 25, 2016
    • Pawan Kumar Yaddanapudi
      October 25, 2016
  16. anand4haridass@gmail.com'
    Anand Haridass
    December 2, 2016
    • Pawan Kumar Yaddanapudi
      December 2, 2016
  17. ran.sam007@gmail.com'
    Rajesh
    December 20, 2016
  18. anil4f@gmail.com'
    Anil Nettikoppula
    March 13, 2017
  19. pratikkdba@gmail.com'
    Pratik
    April 17, 2017
  20. muralisure@gmail.com'
    Murali
    August 29, 2017
    • Pawan Kumar Yaddanapudi
      September 26, 2017
  21. firdossheikh88@gmail.com'
    firdos
    September 27, 2017
    • Pawan Kumar Yaddanapudi
      September 28, 2017

Add Comment