Figure 1
SCAN is new Oracle Real Application Clusters (RAC) 11gR2 feature. It gives a single name for clients to access oracle database running in a cluster.
Basics of SCAN
– Single client access name (SCAN) is the virtual hostname to provide for all clients connecting to the cluster (as opposed to the vip hostnames in 10g and 11gR1).
– SCAN is a domain name registered to at least one and up to three IP addresses, either in the domain name service (DNS) or the Grid Naming Service (GNS).
– By default, the name used as the SCAN is also the name of the cluster and must be globally unique throughout your enterprise.
– For installation to succeed, the SCAN must resolve to at least one address. There can be a maximum of three ip addresses that can be used for the SCAN.
– SCAN VIP addresses must be on the same subnet as virtual IP addresses and public IP addresses.
– SCAN VIPs can float in the cluster while Node VIPs as default run on specific nodes only.
– SCAN Listeners are simply used for redirecting the request received from client, this is usually considered a lightweight process when we compare it to the functioning of Node VIP Listeners as these actually fork a new process to create database conenction.
– SCAN IP address and SCAN listeners are managed as resources in Oracle Clusterware.
– For high availability and scalability, Oracle recommends that you configure the SCAN to use DNS Round Robin resolution to three addresses.
Benefits of SCAN
1) the SCAN makes it possible to add or remove nodes from the cluster without needing to reconfigure clients (Because the SCAN is associated with the cluster as a whole, rather than to a particular node). Before SCAN, if the cluster changed, then the client TNSNAMES.ORA files (or other tns connect strings like Easy Connect strings) would need to change. So your DBA can easily add or delete a node without changing the configuration files.
For example, connection to database “11g” using SCAN would use this tnsnames entry:
11g = (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=rac-scan.corp.to)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=11g)) )
While without SCAN we were using
11g_old = (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=tcp)(HOST=rac1-vip.corp.to)(PORT=1521)) (ADDRESS=(PROTOCOL=tcp)(HOST=rac2-vip.corp.to)(PORT=1521)) ) (CONNECT_DATA=(SERVICE_NAME=11g))
2) It also adds location independence for the databases, so that client configuration does not have to depend on which nodes are running a particular database.
Working
“When a client submits a request, 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 on the least-loaded node (Each scan listener keeps updated cluster load statistics) where the service is currently being offered. Finally, the client establishes connection to the service through the listener on the node where service is offered.All of these actions take place transparently to the client without any explicit configuration required in the client.”
Figure 2 ( taken from Oracle documentation)
Figure 2 above shows where SCAN and Local listeners fits into picture.
Connection flow in case of SCAN is :
1) Client sends connection to SCAN name and a SCAN IP address is provided in return if DNS is used. SCAN IPs are returned in round-robin process. If GNS is used for SCAN ip management then DNS delegates the request to GNS services and GNS services in turn return a SCAN IP address ( again in round-robin fashion)
2) The TNS request is now forwarded to the SCAN Listeners (shown in Fig 2)
3) SCAN listeners in turn forward the request to local listeners ( least loaded one)
4) Local listeners take care of client request.
Setup
In order to successful install grid infrastructure you need to configure your DNS prior to installing the grid infrastructure to resolve the name accordingly. Oracle requires at least one IPs to be configured for the scan name.
You can have two options to define SCAN name
1) Define it in your DNS (Domain Name Service
2) Use GNS (Grid Naming Service)
Also after the setup is done, the remote_listener parameter is made to point to SCAN tnsnames.ora entry and local_listener uses VIP Listener entry. The remote listeners which points to SCAN listeners will do the load balancing and local listeners will take care of new process spawning and connection to database. PMON registers with SCAN listener as defined in parameter ‘ remote_listener’ setting and also with the node listener depending on the local listener settings. On the basis of PMON provided details SCAN will choose the least loaded node to forward the request received from client.
NAME TYPE VALUE ———————————— ———– —————————— remote_listener string rac-scan.global.to:1521 NAME TYPE VALUE ———————————— ———– ———————————————— local_listener string (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP) (HOST=196.1.2.50)(PORT=1521))))
You need to provide SCAN related settings during installation of Grid infrastructure as shown below.
Figure 3
Is it mandatory to use SCAN?
No but It is highly recommended to use SCAN unless there’s strong business reason preventing it from being used.
No comments:
Post a Comment