SCAN-11.2.0 – What You Need to KnowPosted: 03/05/2011
I saw that many problems with feature Oracle SCAN occur due to improper configuration of the environment because of to lack of knowledge on the issue.
Here I’ll post what you should be aware that things work well.
If I ask you to read the concept, maybe you’re not willing to read … then I’ll post the main questions that give us an overview.
What’s 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). The feature SCAN is a new “layer” network (oracle) with high availability that allows you to change the characteristics of your cluster (i.e add/remove nodes) without the need to make configuration changes in their clients “Grid concept”. The IP SCAN and VIP have different goals, therefore working together.
The VIP IP provides high availability at the “tier” of the Cluster.
The SCAN IP provides high availability at the “tier” of the Clients. No matter if we are adding or removing nodes in a cluster or if the nodes are active or inactive, SCAN IP is always available for clients (Managing Connections-Failover) since one node of cluster is active.
How does SCAN work?“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.”
Requirements to set up SCAN?
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), only DNS can resolve more than one IP addresses on the same hostname. That’s possible because only DNS have feature Round-Robim.
SCAN VIP addresses must be on the same subnet as virtual IP addresses and public IP addresses.
By default, the name used as the SCAN is also the name of the cluster and must be globally unique throughout your enterprise. 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 (-).
Can I use HOSTS files to resolve SCAN?Technically works because Oracle requires that this virtual hostname be resolved and using HOSTS this is possible. It’s very important… Use host file ONLY if you are creating a test environment or if will not use the SCAN feature. My recommendation is: NEVER use the HOSTS file to resolve SCAN in a production environment. This will cause a lot issues. 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. The HOSTS file does not resolve more than one entry with the same hostname, only the first entry is resolved. See this example: http://forums.oracle.com/forums/message.jspa?messageID=8392421#8392421
Requirements to set up clients to use SCAN?It is highly recommended you have a DNS. You should always use the hostname (e.g node1-vip) never use IP (e.g 192.168.0.5). This is necessary because Oracle try connect using hostname (not IP) configured on LOCAL/REMOTE Listener on Database. The client MUST resolve and access the following hostname and ports:
- The Virtual hostname of SCAN (e.g host-scan)
- Port of Listener SCAN must be open.
- ALL hostname from Virtual IP of clusterware (e.g node1-vip,node2-vip and so on). This will be necessary because the conection is estabilished by VIP not by SCANIP.
- Port of Local Listener must be open.
nslookup host-scan ping -c node1-vip ping -c node2-vip ping -c host-scan tnsping node1-vip tnsping node2-vip tnsping host-scan # First test througth VIP sqlplus scott/tiger@node1-vip:1521/testsvc sqlplus scott/tiger@node2-vip:1521/testsvc # So test througth SCAN sqlplus scott/tiger@host-scan:1521/testsvc
Why not setup only one SCANIP to SCAN?
Sebastian Wrote:if you only use one, then you only have 1 SCAN VIP and 1 SCAN listener. One scan vip and listener can only be active on one node at a time, and will failover to another.
So there are some things to know
1.) What happens, if you only have one listener instead of 3, regarding connections:
Connections will not be distributed on multiple SCAN listener, but always end up on the same. So be carefull, that this is not a bottleneck.
Connection storms on 1 listener is simply more likely to happen, than if you have 3. But this can be avoided, in setting up the clients in a manner they don’t open 100rds of connections at the same time – and with some listener.ora parameters.
2.) What happens, if the listener is not available (because it’s in the process of failing over):
With 3 scans, the client will simply switch to the next one and get a connection. With only 1 scan, the client will get an error (No listener).
So for the time of the failover with only 1 scan, there will be unsuccessful connection attempts. However relocation of the SCAN VIP and listener is normally quite fast…
However the listener registration by the database (from PMON) is only done every 60 seconds. So if listener is up (after failover), but no service registered (yet), the clients mayl recieve an error (No service).
3.) What happens, if for any reason this one scan listener fails and cannot be restarted.
While very unlikely to happen, because the clusterware tries to avoid this, this would result in a complete “inavailability” of the cluster. With 3 scans, while not good that one listener isn’t running, it does not matter. http://forums.oracle.com/forums/message.jspa?messageID=9554024#9554024
Why not use VIP or Public ?Because for us to have the concept of GRID we must configure the feature only one time and it will self manage and make cluster transparent to yours clients.
If you add or remove an NODE it’s require to modify the connections of yours all clients (VIP/PUBLIC IP) you broke the concept of GRID. (This makes a big difference when you have many clients i.e.: Over 20 clients.)
If we remove or add node we must configure the clients to use/or not this node. Using SCAN he do this automatically.
Do we still need to configure local listeners on each node?Yes, you would need to configure independent local listeners for each node. SCAN listeners are not replacements for the node listeners.
A new set of cluster processes called scan listeners will run on three nodes in a cluster (or all nodes 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.