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.
- Let us understand the components related to SCAN individually and then relate them together to understand SCAN in COMPLETE.
- Let us now understand the architecture of SCAN with the help of below image that serves the user requests from application server.
- 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:
- 0 sec: User1 when tries to establish a session on database with connection request C1, it hits DNS server first.
- DNS server will then resolve the name “SCAN_LISTENER” to the first IP 192.168.122.5
- 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.
- 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.
- 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.
- 5th sec: User2 when tries to establish a session on database with connection request C2, it hits DNS serer first.
- DNS server will now use Round-Robin algorithm and resolves the name “SCAN_LISTENER” to second IP 192.168.122.6
- 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.
- 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.
- 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 —