Wednesday, 20 June 2012

SCAN listener

What is SCAN listener?
Single Client Access Name (SCAN) is a new feature of Oracle Real Applications Clusters (RAC) 11g Release that provides a single name for the clients to access Oracle Database running in a cluster. The benefit of the SCAN Listener is that the client's connection data does not need to changed if you add or delete a node from a cluster.
The Single Client Access Name is configured during the installation of Oracle Grid Infrastructure. Once configured, application tier connection descriptors just specify the SCAN name rather than all the [virtual] hosts in the cluster.
Without the Single Client Access Name, the descriptor for a two-node cluster would be
VISION =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=C1-vip)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=C2-vip)(PORT=1521)))
(CONNECT_DATA=(SERVICE_NAME=VISION)))
With the Single Client Access Name, just the SCAN name needs to be specified:
VISION = (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=C-SCAN)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=VISION)))
The benefit of the Single Client Access Name becomes apparent as the number of nodes in the cluster increases.

Question: I hear that Oracle 11g release 2 has a new RAC feature called SCAN (Single Client Access Name). How does SCAN replace TAF in a RAC cluster? Should I use SCAN instead of manual load balancing?
Answer: According to reliable sources on the web, SCAN provides a single domain name via DNS), allowing and-users to address a RAC cluster as-if it were a single IP address. SCAN works by replacing a hostname or IP list with virtual IP addresses (VIP). SCAN is part of the 11g release 2 movement toward "RAC Virtualization". Virtualization is great for some RAC shops, not so good for others.
Expert Note: SCAN is an automatic load balancing tool that uses a relatively primitive least-recently-loaded algorithm. Most Fortune 50 mission critical RAC systems will not use an automated load balancer in favor of intelligent RAC load balancing., where you direct like-minded transactions to like-minded nodes. This approach greatly reduces the load on the cache fusion payer because less blocks must be sent across the RAC interconnect.
According to Oracle, there are two benefits for SCAN:
  • Fast RAC failover: If a node fails, Oracle detects the loss of connection to the VIP and redirects new connects to the surviving VIP's. This is an alternative to the transparent application failover. (TAF) for automatic load balancing.
  • Easier maintenance for Grid RAC systems: For Grid systems that gen-in and gen-out blade servers frequently, SCAN offers easier change control for the RAC DBA. As RAC nodes are added or deleted, the DBA does not have to change the configuration files to reflect the current list of RAC node IP addresses (or hostnames). In a nutshell, SCAN allows a single cluster alias for all instances in the cluster.
Configuring RAC to use SCAN
The set-up for SCAN is implemented as follows:
STEP 1 - Add a new DNS entry for SCAN (e.g. /etc/hosts). This will create a single DNS domain name that resolves to all of the IP addresses in your RAC cluster (one for each node). This will use a round-robin algorithm

root> cat /etc/hosts

myscan.mydomain.com IN A 122.22.22.22 IN A 122.22.22.23 IN A 122.22.22.24
STEP 2 - Create a SCAN VIP for each IP address in step 1.
STEP 3 - Create a SCAN listener for each VIP that was created in step 2.
STEP 4 - Change the tnsnames.ora file. This entry will point SCAN to the single DNS hostname created in step 1. Prior to the introduction of SCAN (11g r1 and earlier using TAF or intelligent load balancing ), the tnsnames.ora file contained a list of hostnames, one for each node in the cluster:
SCANDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myscan1.mydomain.com)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = myscan2.mydomain.com)(PORT = 1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = myscan3.mydomain.com)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SCANDB)
)
)
STEP 5 - Set the remote_listener and local_listener parameters: You want to set your remote_listener parameter to point to a tnsnames.ora entry for SCAN as defined in step 4.
remote_listener=myscan.mydomain.com:1522

The SCAN listener for RAC
This single domain addressing is implemented via a “scan listener” and the status can be checked with the standard lsnrctl command, passing the SCAN listener name as an argument:
oracle> lsnrctl service
oracle> lsnrctl stat myscan_listener
LSNRCTL for UNIX: Version 11.2.0.1.0 . .

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

STATUS of the LISTENER . . .
Server control commands for SCAN
$ ps -aef |grep -i SCAN
According to Karen Reidford, there are several new server control (srvctl) commands for SCAN:
New SRVCTL Command
What it does
srvctl config scan
Shows the current SCAN configuration
srvctl config scan_listener
Shows the existence and port numbers for the SCAN listeners
srvctl add scan -n cluster01-scan
Adds new SCAN information for a cluster
srvctl remove scan –f
Removes SCAN information
srvctl add scan_listener
Adds a new SCAN listener for a cluster on the default port of 1521
srvctl add scan_listener -p 65001 ## non default port number ##
Adds a new SCAN listener on a different port
srvctl remove scan_listener
Removes the SCAN listener
srvctl modify scan -n cluster_scan
Modifies SCAN information (used when changing SCAN to DNS after initially using /etc/hosts)
srvctl modify scan_listener –u
Modifies the SCAN listener information to match the new SCAN VIP information from the modify scan command




No comments:

Post a Comment