Professional Documents
Culture Documents
Ora Net 2a
Ora Net 2a
Ora Net 2a
a) Single client access name (SCAN) is the virtual hostname to provide for all clients connect
ing to the cluster (as opposed to the VIP hostnames in 10g and 11gR1).
b) 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).
c) 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.
d) For installation to succeed, the SCAN must resolve to at least one address.
e) SCAN VIP addresses must be on the same subnet as virtual IP addresses and public IP addre
sses.
f) 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.
g) If the hosts file is used to resolve SCAN hostname, you will receive Cluster Verification
Utility failure at end of installation.
h) For high availability and scalability, Oracle recommends that you configure the SCAN to use
DNS Round Robin resolution to three addresses.
i) 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 conf
iguration does not have to depend on which nodes are running a particular database.
j) 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.
k) 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.
l) SCAN listener will be running off GRID_HOME, and by default, in 11gR2 local listener will
be running off GRID_HOME as well.
m) In 12c, SCAN supports multiple subnets in the cluster (one SCAN per subnet)
If the SCAN name resolves to one IP address, root script (root.sh or rootupgrade.sh) will create the
number of SCAN VIP resources(ora.scan1.vip) and corresponding SCAN listener resource (ora.
LISTENER_SCAN1.lsnr) depend on how many IP addresses the SCAN name resolves to, i.e.if
the SCAN name resolves to two IP addresses, it will create two SCAN VIP resources and two
corresponding SCAN listener resource.
SCAN VIP and the corresponding SCAN listener works like a pair, when SCAN VIP fails over to
other node, the corresponding SCAN listener will also be failed over to the same node.
When SCAN VIP fails over happens, it will always select a node with least running SCAN VIP,
i.e., if SCAN VIP runs on node1, node2 and node3 of a 4-node cluster, if node3 goes down, the
SCAN VIP and corresponding SCAN listener will be failed over to node4 as the other two nodes
already have one SCAN VIP running on each node.
Also, we can use ‘srvctl’ to add/modify the scan resource and the listeners.
A new set of cluster processes called scan listeners will run on three nodes in a cluster (or all no
des if there are less than 3). If you have more than three nodes, regardless of the number of nodes
you have, there will be at most three scan listeners. The database registers with the SCAN listener
through the remote listener parameter in the init.ora/spfile. If any of these clustered processes fail,
they are automatically restarted on a new node.
The following is the explanation given in Appendix D “Oracle Grid Infrastructure for a Cluster
Installation Concepts” of the Oracle Grid Infrastructure Installation Guide:
“When a client submits a request, the SCAN listener listening on a SCAN IP address and the SC
AN 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 a 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.”
$ SRVCTL STATUS SCAN_LISTENER
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node TEST1
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node TEST2
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node TEST3
Can we use the previous method (Using VIP) for client connection?
Clients can continue to access the cluster in the same way as with previous releases. Vips are still
used internally, and can still be used for connections. But Oracle strongly recommends that clients
accessing the cluster use the SCAN. Clients using the SCAN can also access the cluster using
EZCONNECT.
Demo:
Sample TNS entry for SCAN:
TEST.ORACLE.COM=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST= SCAN-TEST.
ORACLE.COM)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=11GR2TEST.ORACLE.COM)))
How does SCAN replace TAF in a RAC? 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).
Because SCAN determines the actual node and listener which accepts the connection, SCAN
provides location independence for the databases. A SCAN database connection does not require
any details about a particular node on instance. 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-rec
ently-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 trans
actions 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.
Easier maintenance for Grid RAC systems: For Grid systems that gen-in/out blade servers freque
ntly, SCAN offers easier change control for the 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 addr
esses/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 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_list
ener parameter to point to a tnsnames.ora entry for SCAN as defined in step 4.
remote_listener=myscan.mydomain.com:1522
The IP addresses associated with the SCAN VIP resources are initially set when the SCAN resour
ces are created. Any changes to the DNS entry for the SCAN are not automatically propagated to
the clusterware and need to be done manually. This applies only to installations that are not using
GNS. The information in this note can also be helpful in cases where SCAN was originally config
ured with just one address and is now being expanded to accommodate three IP addresses.
Stopping&starting the SCAN resources can be done by the grid user, however, the ‘srvctl modify
scan’ cmd must be executed by the root user, so it’s practical to execute all steps as the root user.
Modifying SCAN VIP resources
1. Before the SCAN VIPs can be changed, the entry for the SCAN name on the Domain Name
Server (DNS) needs to be updated with the new IP addresses. This usually will be done by a netw
ork administrator. To check the current setting, the following cmd can be used:
# nslookup [scan_name]
A lookup of the SCAN on the DNS server shows that the entry has already been updated with the
new IP addresses:
$ nslookup scan.example.com
Server: dns1.example.com
Address: 10.100.10.70#53
Name: scan.example.com
Address: 10.100.10.123
Name: scan.example.com
Address: 10.100.10.122
Name: scan.example.com
Address: 10.100.10.121
2. To check the current IP address(es) of the SCAN VIPs, run the following cmds as the root user:
# $GRID_HOME/bin/srvctl config scan
The SCAN VIP resources will still show the old IP addresses:
# $GRID_HOME/bin/srvctl config scan
SCAN name: scan, Network: 1/10.100.10.0/255.255.255.0/eth1
SCAN VIP name: scan1, IP: /scan.example.com/10.100.10.81
SCAN VIP name: scan2, IP: /scan.example.com/10.100.10.82
SCAN VIP name: scan3, IP: /scan.example.com/10.100.10.83
4. Next refresh the SCAN VIPs with the new IP addresses from the DNS entry:
# $GRID_HOME/bin/srvctl modify scan -n [scan_name]
For example :
# $GRID_HOME/bin/srvctl modify scan -n scan.example.com
5. To check if the SCAN VIPs have been changed, run the following cmd, it should now show the
new IP addresses.
# GRID_HOME/bin/srvctl config scan
SCAN name: scan, Network: 1/10.100.10.0/255.255.255.0/eth1
SCAN VIP name: scan1, IP: /scan.example.com/10.100.10.121
SCAN VIP name: scan2, IP: /scan.example.com/10.100.10.122
SCAN VIP name: scan3, IP: /scan.example.com/10.100.10.123
7. If the number of SCAN VIPs has changed, the SCAN listener needs to be updated:
# GRID_HOME/bin/srvctl modify scan_listener -u
NOTE: If the SCAN VIPs are being changed because of a change of the subnet of the public netw
ork additional changes may be required , e.g. the node VIPs and the network resource (ora.net1.
network). For more information please refer to Document 276434.1
I have configured 3 SCANs using DNS, you can use GNS as well if no DNS in your network
environment! In Easy Words, SCAN is another layer over VIP, SCAN is basically a name and
gives you the flexibility to be little independent of the IPs, Once your client Access the SCAN
Name, DNS will resolve it to Assigned IPs then connection will be routed to one of the SCAN
Listeners which further routs the connection to one of the VIP! Enjoy more flexibility, Adding new
nodes in Grid is not any issue, 3 SCANs recommended to be more flexible and redundant, Client
connection strings are not required to change after adding/removing nodes from Grid/RAC.
* Elaborations*******************
SCAN: Single Client Access Name -- Allowing client to access whole cluster/grid through one
name, rather specifying all VIP addresses individually
SCAN Requirement: To be able to get SCAN Functionality, We need some service through which
one name is resolved to multiple IPs/hosts. This is what we often call "DNS", Domain name
service or if you don't have DNS in your environment then you can use Oracle's "GNS (Grid
Naming Service)"
SCAN Usage: During Oracle Grid Installation, Specify mentioned IPs, Each VIP Listener on each
node will register itself will Every SCAN Listener on whatever node the SCAN Listener is
running.
Que#1: Will three SCAN listeners have same same port to listen?
ANS: Yes all three Scan Listeners will have same port and you can choose the port and the port
will be different than the port used for VIP listeners. :-) Can't Share the port# which i used in my
production.
Que#2: Three SCAN listeners take the request parallel?
ANS: Yes three Scan listeners will run in parallel and accept requests, DNS will route request to
one of the SCAN Listener.
Que#3: So from 11.2 onwards we are not using VIP?
ANS: VIPs still exists on each node, But we dont use VIPs in our client connection string instead
we we use one SCAN-Name.
I would recommend to you read my previous post again carefully and now i ll give an example
below to explain in detail, Hope i ll be able to bring you on same page!
Advantage of SCAN: Previously we specified all the VIPs in our client connections but now you
need to specify only one "SCAN Name" in your client address. If you Add/Remove Nodes in your
RAC then you dont need to update your client connection strings, The only change will be done in
DNS.