One of the maintenance challenges with RAC is maintaining all of the client connection files (TNSNAMES.ora) every time a change is made to a cluster database configuration. A new feature of Oracle Database 11g RAC databases, and a primary benefit, is the Single Client Access Name (SCAN). Read on to learn more…
One of the new features of Oracle Database 11g Real Application Cluster (RAC) databases is the ability to have a single connection setting for client systems to use when connecting to a RAC database. The primary benefit of a Single Client Access Name (SCAN) is not having to update client connection information (such as TNSNAMES.ora) every time you add or remove nodes from an existing RAC cluster.
Clients use a simple EZconnect string and JDBC connections can use a JDBC thin URL to access the database, which is done independently of the physical hosts that the database instances are running on. Additionally, SCAN automatically provides both failover and load balancing of connects, where the new connection will be directed to the least busy instance in the cluster by default.
It should be noted here that because EZconnect is used with SCAN, the SQLNET.ora file should include EZconnect as one of the naming methods, for example:
NAMES.DIRECTORY_PATH=(tnsnames,ezconnect,ldap) An EZconnect string would look like sqlplus user/pass@mydb-scan:1521/myservice A JDBC thin string would look like jdbc:oracle:thin@mydb-scan:1521/myservice
It’s highly recommended that the clients are Oracle 11g R2 clients, to allow them to fully take advantage of the failover with the SCAN settings.
The TNSNAMES.ora file would now reference the SCAN rather than the VIPs as has been done in previous versions. This is what a TNSNAMES entry would be:
MYDB (DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=mydb-scan.ORACLE.COM)(PORT=1521)) (CONNECT_DATA=(SERVICE_NAME=myservice.ORACLE.COM)))
There are two methods available for defining the SCAN. These are to use your corporate DNS to define the SCAN; the second option is to use Grid Naming Service.
To use the DNS method for defining your SCAN, the network administrator must create a single name that resolves to three separate IP addresses using round-robin algorithms. Regardless of how many systems are part of your cluster, Oracle recommends that 3 IP addresses are configured to allow for failover and load-balancing.
It is important that the IP addresses are on the same subnet as the public network for the server. The other two requirements are that the name (not including the domain suffix) are 15 characters or less in length and that the name can be resolved without using the domain suffix. Also, the IP addresses should not be specifically assigned to any of the nodes in the cluster.
You can test the DNS setup by running an nslookup on the scan name two or more times. Each time, the IP addresses should be returned in a different order:
Grid Naming Solutions (GNS)
Using GNS assumes that a DHCP server is running on the public network with enough available addresses to assign the required IP addresses and the SCAN VIP. Only one static IP address is required to be configured and it should be in the DNS domain.
Oracle Grid Infrastructure Installation
The Oracle Grid Infrastructure is a single Oracle Home that now includes both Oracle Clusterware and Oracle Automatic Storage Management (ASM). The Oracle Grid Infrastructure is a required prerequisite for Oracle 11g RAC R2. As part of the installation process for Grid Infrastructure, you will be asked to provide the cluster name, SCAN name and listener port for the SCAN listeners. Optionally you can also provide Grid Naming Service (GNS) information, which includes the GNS Sub Domain Name and the GNS VIP Address.
Specifying a SCAN that resolves to at least one IP address is essential to the installation and configuration of the Grid Infrastructure and RAC and the installer will not allow you to proceed past this step until a suitable SCAN has been provided.
There is a workaround available using /etc/hosts if you have the ability to set up a DNS or GNS based solution. However, with /etc/hosts you will only be able to set up 1 SCAN and it would have to resolve to exactly 1 IP address. You will also have to ensure that you change the /etc/hosts file on every system in your cluster.
This workaround is primarily available for upgrading from previous versions to Oracle 11g R2, and you should set up either a DNS or GNS based solution after the upgrade is complete.
As part of the installation, the OUI will create SCAN listeners on each node in the cluster, which are not replacements for a regular listener.
Database Parameters for SCAN
The database will register each instance to the scan listener using the REMOTE_LISTENER parameter in the spfile. Oracle 11g R2 RAC databases will only register with the SCAN listeners. Upgraded databases, however, will continue to register with the local listener as well as the SCAN listener via the REMOTE_LISTENER parameter. The LOCAL_LISTENER parameter would be set to the node VIP for upgraded systems.
The REMOTE_LISTENER parameter, rather than being set to an alias that would be in a server side TNSNAMES file (as it has been in previous versions), would be set simply to the SCAN entry: The alter command would be
ALTER SYSTEM SET REMOTE_LISTENER=mydb-scan.oracle.com:1521
SRVCTL Commands for SCAN
Oracle’s SRVCTL utility has been expanded to include a number of new commands specifically for SCAN. Some of these new commands are listed in the table below:
|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|
New SQL*NET Parameters
Two new parameters are available for the TNSNAMES entries. These are CONNECT_TIMEOUT=nn which specifies a time in seconds for the connection to the database to be established. The second is RETRY_COUNT. These would be used in conjunction with having more than one SCAN configured for your cluster. The TNSNAMES entry would look like this:
MYDB (DESCRIPTION=(CONNECT_TIMEOUT=15)(RETRIES=5) (ADDRESS=(PROTOCOL=TCP)(HOST=mydb-scan1.ORACLE.COM)(PORT=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST=mydb-scan2.ORACLE.COM)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME=myservice.ORACLE.COM)))
Overall, this new feature will save DBAs some additional work and time when they are changing the structure of their RAC databases, and still be able to maintain the advantages of load balancing and failover of client connections to the listeners.
For more information on SCAN, you may refer to My Oracle Support (Metalink) Note # 887522.1