What is SCAN in Oracle RAC?

Single Client Access Name (SCAN) is an Oracle Real Application Clusters (Oracle RAC) feature that provides a single name for clients to access Oracle Databases running in a cluster.

And we can say that SCAN is a cluster alias for database.

The benefit is that SCAN-NAME you provide for client connection is enough to connect to your database in RAC cluster. You don’t need to worry even if nodes or databases are added or removed from cluster.

Having a single name to access the cluster to connect to a database allows clients to use EZConnect and the simple JDBC thin URL to access any database running in the cluster, independently of the number of databases or servers running in the cluster and regardless on which server(s) in the cluster the requested database is actually active.

Example :

Ezconnect : sqlplus system/manager@rac-scan:1521/orcl1

JDBC connect jdbc:oracle:thin:@rac-scan:1521/orcl1

Now , RAC components that comes into picture when you talk about SCAN Listeners are

  • SCAN VIP
  • SCAN LISTENER
  • NODE VIP

1.SCAN VIP : SCAN VIPs are physical IP addresses that you allocate to SCAN listener. When you check clusterware resource with Number of SCAN VIP’s you notice it will be same as the Number of SCAN LISTENERS in the setup.

SCAN VIP is one of the resources you find in the output of crsctl status resource –t command.

[oracle@rac1 ~]$ crsctl status resource -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS 
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
 ONLINE ONLINE rac1 
 ONLINE ONLINE rac2 
ora.LISTENER.lsnr
 ONLINE ONLINE rac1 
 ONLINE ONLINE rac2 
ora.asm
 ONLINE ONLINE rac1 Started 
 ONLINE ONLINE rac2 Started 
ora.gsd
 OFFLINE OFFLINE rac1 
 OFFLINE OFFLINE rac2 
ora.net1.network
 ONLINE ONLINE rac1 
 ONLINE ONLINE rac2 
ora.ons
 ONLINE ONLINE rac1 
 ONLINE ONLINE rac2 
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
 1 ONLINE ONLINE rac2 
ora.LISTENER_SCAN2.lsnr
 1 ONLINE ONLINE rac1 
ora.LISTENER_SCAN3.lsnr
 1 ONLINE ONLINE rac1
ora.cvu
 1 ONLINE ONLINE rac1 
ora.oc4j
 1 ONLINE ONLINE rac1 
ora.orcl.db
 1 ONLINE ONLINE rac1 Open 
 2 ONLINE ONLINE rac2 Open 
ora.rac1.vip
 1 ONLINE ONLINE rac1 
ora.rac2.vip
 1 ONLINE ONLINE rac2 
ora.scan1.vip
 1 ONLINE ONLINE rac2 
ora.scan2.vip
 1 ONLINE ONLINE rac1 
ora.scan3.vip
 1 ONLINE ONLINE rac1
[oracle@rac1 ~]$

We can see above output scan1 , scan2 and scan3 VIPs are in online state.It means  IP addresses are online on the physical network ports. Only when SCAN VIPs are online we can start the SCAN listeners.

Now let us understand SCAN-listener.

2.SCAN-LISTENER : Scan Listener is oracle rac’s component which starts running a service on the  port [default 1521] using IP address assigned to SCAN VIPs. Yes, so I am repeating , SCAN listener wont be able to start unless SCAN VIP is online.

Name that is given to SCAN LISTENER is referred as SCAN NAME and it should be registered in DNS server.

3.Node VIP: Each node in the RAC cluster has its own node VIP. It is high availability resource of RAC that can able to initially connect to database service on its node or to fail over to another cluster node and advise that its node is down. When database application wants to connect to a database services , it specifies list of node VIPs so that one is fail another can be tried.

It has capability of relocating to local listener of other node when the current node goes down.

Image Source : OrSkl Scan Post

Let us understand the diagram in depth.

scan-listener is registered with remote_listener  parameter of all instance .

SQL> show parameter remote_listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_listener                      string      rac-scan:1521
SQL>
  1. As shown here first request is generated , at zero second. User 1 has made request for connection to orcl database in cluster with following tnsnames.ora entry.
[oracle@rac1 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /appndb/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

[oracle@rac1 admin]$

2. Once user has made request , a request will go to DNS server to resolve host name defined in tns entry. DNS server will use Round_Robin method and resolves 192.168.122.5 IP address.

3. As per example we have 3 IPs assigned for SCAN-name : 192.168.122.5

  • 192.168.122.6
  • 192.168.122.7

4. Then C1 request reaches the first scan listener , mostly the default name will be LISTENER_SCAN1 which is running on 192.168.122.5 SCAN VIP . SCAN1 will use Load balancing adviser , and identifies load in each node in the cluster and routes the C1 request to least loaded node. In our case request sent to node 2 which has no load for now.

Then C1 request will be addressed by local listener on this node which helps C1 to establish a session on node 2 instance.

Stay tuned for More articles on Oracle RAC

Thank you for giving your valuable time to read the above information.

If you want to be updated with all our articles send us the Invitation or Follow us:

Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/

Joel Perez’s LinkedIn: Joel Perez’s Profile

Anuradha’s LinkedIn: Anuradha’s Profile

LinkedIn Group: Oracle Cloud DBAAS

Facebook Page: OracleHelp

About The Author

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.