Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, July 4, 2019

Single Client Access Name (SCAN):

Single client access name (SCAN): 

  • Introduced in Oracle 11g Release 2.
  • It provides a single name for clients to access any Oracle Database running in a cluster.
  • Client’s connect information does not needs to be changed if you add to or remove nodes from cluster. 
  • SCAN also provides the connect time load balancing so it forwards the request to least loaded node in the cluster.
  • This can resolve upto maximum three IP address and minimum one.

SCAN Concepts:
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. The default value for the SCAN is based on the local node name. SCAN name must be at least one character long and no more than 15 characters in length, must be alphanumeric - cannot begin with a numeral and may contain hyphens (-). If you require a SCAN that is longer than 15 characters, then select an Advanced installation.

For installation to succeed, the SCAN must resolve to at least one address.

SCAN VIP addresses must be on the same subnet as virtual IP addresses and public IP addresses.
Oracle strongly recommends that you do not configure SCAN VIP addresses in the hosts file. But if you use the hosts file to resolve SCAN name, you can have only one SCAN IP address.

If hosts file is used to resolve SCAN hostname, you will receive Cluster Verification Utility failure at end of installation (see Note: 887471.1 for more details).

For high availability and scalability, Oracle recommends that you configure the SCAN to use DNS Round Robin resolution to three addresses.

Because the SCAN is associated with the cluster as a whole, rather than to a particular node, the SCAN makes it possible to add or remove nodes from the cluster without needing to reconfigure clients. 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.

Clients can continue to access the cluster in the same way as with previous releases, but Oracle recommends that clients accessing the cluster use the SCAN. Clients using the SCAN can also access the cluster using EZCONNECT.

Grid Infrastructure will start local listener LISTENER on all nodes to listen on local VIP, and SCAN listener LISTENER_SCAN1 (up to three cluster wide) to listen on SCAN VIP(s); 11gR2 database by default will set local_listener to local LISTENER, and remote_listener to SCAN listener.

SCAN listener will be running off GRID_HOME, and by default, in 11gR2 local listener will be running off GRID_HOME as well.

In 12c, SCAN supports multiple subnets in the cluster (one SCAN per subnet)

How does SCAN work ?

SCAN is a GSD resource, which is managed by CRS.So, SCAN is pretty much aware of what's going on in the cluster. Though Oracle documentation suggests that SCAN is a recommendation, but its a kind of mandatory as Oracle 11gR2 OUI would not proceed without it. Clients use SCAN name in tnsnames.ora to make the DB connection. SCAN Listener would forward the request to local listener that’s running on VIPs.

So, SCAN needs to resolve to one to three IP addresses with the same name. Oracle recommends using three IP Addresses for SCAN in DNS. There would be three SCAN listeners only, though the cluster has got dozens of nodes. SCAN listeners would be started from GRID Oracle Home, not the database/rdbms home. Since its part of a grid, this can be used for all the database in the cluster. So, we don't to run netca to create listeners in DB Homes anymore. If the default port, 1521, is used, Oracle instances (PMON) automatically registers with the SCAN listener.

PMON process of each instance registers the database services with the default listener on the local node and with each SCAN listener, which is specified by the REMOTE_LISTENER database parameter.
Oracle client connects using SCAN name: myscan:1521/sales.example.com
Client queries DNS to resolve scan_name.
SCAN listener selects least loaded node (node in this example)
The client connects to the local listener on node2. The local listener starts a dedicated server process for the connection to the database.
The client connects directly to the dedicated server process on node2 and accesses the sales2 database instance.

Need to under stand these term:

SCAN NAME, SCAN VIP, SCAN Listener, Node VIP, Local_Listener and Remote_Listener

SCAN NAME:
It must be unique.
This name is used in Tnsname.ora file of client system, all database connection are made thorugh this name.
Below commnad for scan name details:

[oracle@rac1 bin]$ srvctl config scan
[oracle@rac1 bin]$ nslookup orarac-scan
[grid@rac1 ~]$crsctl stat res -w "TYPE = ora.scan_listener.type"

SCAN VIP:
SCAN NAME resolves to one or more than one IP addresses, these IP address are called as SCAN VIP or SCAN IP.
Each Scan VIP has a SCAN Listener correspondingly.
SCAN Listener can runs on any of nodes or there could be two SCAN Listener running on one node if there are three SCAN Listener and only two nodes.SCAN VIP and SCAN Listener works as a pair.

Command to get SCAN Listener and corresponding SCAN VIP.

[oracle@rac1  ~]$ ps -ef | grep tnslsnr
grid     29211     1  0 Jul28 ?        00:00:27 /u01/app/11.2.0.3/grid/bin/tnslsnr LISTENER_SCAN3 -inherit

[oracle@rac1 ]$ lsnrctl status LISTENER_SCAN3

** SCAN Listener LISTENER_SCAN3 is running .

SCAN Listener:
SCAN Listener used to run on database nodes. At max there could be three SCAN Listeners in the whole cluster.

SCAN Listeners:

[oracle@database ~]$ srvctl status scan_listener

Node VIP:Each node has one node IP and one node VIP address in RAC env.These have differences like Node VIP can be moved to any other system in case of  failure of current owning system but Node IP can't.
When a new connection comes,SCAN listener listening on a SCAN IP address and the SCAN port is contacted.As every services is registered with SCAN listener in cluster,the SCAN listener responds with local listener address as Node VIP whichever is  least-loaded(Scan listener keeps updated with cluster load statistics) and connection is routed to same node.

Local_Listener:This is a database parameter which is to provide detail of local listener running on database node.This has Node VIP address as value in RAC. Local Listener  is registered with Node VIP and Node IP address.

The difference between SCAN Listener and Local Listener is SCAN listener runs corosponding to SCAN VIP's while Local Listener runs with Node VIP or Node IP address.SCAN Listener can move to another database node in case of node failure but local Listener doesn't have this kind of behavior.

SQL> show parameter local_listener

Remote_Listener:This parameter set to SCAN NAME.SCAN NAME has one or more IP address called as SCAN VIP.Each SCAN VIP has SCAN Listener running, therefore each database instance register itself with all SCAN Listeners running.

Remote_listener parameter is basically to register each database instance with all SCAN Listeners. This also provide information like services provided by the instance,current load and provide recommendation on how many incoming connections should be directed to the instance.

SQL> show parameter remote_listener


Difference between local and remote listener:





===================

What is SCAN:

Single client access name (SCAN)SCAN is a GSD resource, which is managed by CRS. Single client access name (SCAN).It is introduced in Oracle 11g R2.Main purpose of SCAN is to provide ease of management/connection.

No comments:

Post a Comment