Saturday 31 July 2010

Scan Reconfiguration

As you may know, SCAN (Single Client Access Name) is a new feature that has been introduced in 11.2 Oracle RAC. To put it simply, the SCAN is actually a single name alias which can be configured for clients to connect to the cluster database. In addition it will also handle the load balancing and failover for client connections. When the nodes in the cluster changes (eg. added or removed), the benefits of SCAN can be realised, as there is no requirement for the client to be reconfigured.

A good example on configuring SCAN for clients, Pas from Oracle has written an article which explains how this can be achieved. Just visit his blog entry Using SCAN – Single Client Access Name to Connect to 11g R2 RAC from JDeveloper 11g.

Configuring your clients to used SCAN in 11.2 or later is optional, however when you install the Grid Infrastructure software for RAC, the SCAN is still required to be configured for setup of the cluster.
It is recommended that the SCAN is resolvable to 3 IP addresses. However a minimum of 1 IP Address may be configured. It should also be registered in DNS for round robin resolution.

Reconfiguration of SCAN

There may be situations where reconfiguration of the SCAN for the cluster is required.
Some examples are:
  • Allocation of IP addresses has changed for SCAN
  • Adding additional IP addresses for SCAN
  • DNS Changes associated with SCAN addressing
  • SCAN name change^
NOTE: ^ SCAN name change may be required if there is conflicting name for another cluster on same network or in DNS, however this would mean that client reference to old SCAN is required be updated. Hence caution should be taken to ensure that SCAN name is unique in DNS and network.

In the below scenario, the following steps will show how SCAN addressing can be reconfigured for a cluster.

At the time of the installation, the DNS registration had not been setup. As a workaround, one of the IP addresses allocated for the SCAN was referenced in the /etc/hosts file. Once the installation was completed and DNS registration updated, the SCAN was then reconfigured to be resolvable through DNS for all 3 IP addresses.

Below is the summary of the current and new configuration for SCAN.

CurrentNew
SCAN Namemyscanmyscan
SCAN IP Address172.43.22.89172.43.22.89
172.43.22.90
172.43.22.91
SCAN entry in /etc/hosts fileYes*No
Registered in DNS and configured for round robinNoYes

NOTE: SCAN entry in the /etc/hosts file is not recommended, hence the reconfiguration to the NEW is required.

1. Verify Current Configuration for SCAN VIP
oracle@lnx01[GRID]:/app/oracle> srvctl config scan
SCAN name: myscan, Network: 1/172.43.22.0/255.255.255.0/bge0:nxge0
SCAN VIP name: scan1, IP: /myscan.earth.com/172.43.22.89
2. Verify status of SCAN Listener:
oracle@lnx01[GRID]:/app/oracle> srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node lnx02
3. Verify Current Configuration for SCAN Listener
oracle@lnx01[GRID]:/app/oracle> srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
4. Verify Status for SCAN Listener
oracle@lnx01[GRID]:/app/oracle> srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node lnx02
5. Stop the SCAN Listener
oracle@lnx01[GRID]:/app/oracle> srvctl stop scan_listener
6. Stop the SCAN VIPs
oracle@lnx01[GRID]:/app/oracle> srvctl stop scan
7. Verify Status for SCAN Listener has stopped
oracle@lnx01[GRID]:/app/oracle> srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is not running
8. Verify Status for SCAN VIP has stopped
oracle@lnx01[GRID]:/app/oracle> srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is not running
9. Update SCAN in DNS and associated IPs as required 10. Verify that resolv.conf is configured to search DNS domain that SCAN was registered for
oracle@lnx01[GRID]:/app/oracle> cat /etc/resolv.conf
search        earth.com
nameserver      172.43.7.1
nameserver      172.44.7.1
11. Verify that in DNS that that the SCAN is resolvable against all three IP Addresses
oracle@lnx01[GRID]:/app/oracle> nslookup myscan
Server:         172.43.7.1
Address:        172.43.7.1#53
Name:   myscan.earth.com
Address: 172.43.22.89
Name:   myscan.earth.com
Address: 172.43.22.90
Name:   myscan.earth.com
Address: 172.43.22.91
12. Verify that the scan IP and address name has been removed or commented out from the /etc/hosts file:
oracle@lnx01[GRID]:/app/oracle> grep myscan /etc/hosts
NOTE: In this example no rows are returned as IP and address name has been removed for scan
13. Modify the SCAN resource so that it update all SCAN VIPs resolvable by DNS
oracle@lnx01[GRID]:/app/oracle> sudo srvctl modify scan -n myscan
14. If the SCAN name was changed as well, run the following to update in Cluster Resource Control
oracle@lnx01[GRID]:/app/oracle> sudo crsctl modify type ora.scan_vip.type -attr "ATTRIBUTE=SCAN_NAME,DEFAULT_VALUE=myscan"
15. Verify that all SCAN VIPs are now resolvable and registered with the SCAN resource
oracle@lnx01[GRID]:/app/oracle> srvctl config scan
SCAN name: myscan, Network: 1/172.43.22.0/255.255.255.0/bge0:nxge0
SCAN VIP name: scan1, IP: /myscan.earth.com/172.43.22.90
SCAN VIP name: scan2, IP: /myscan.earth.com/172.43.22.91
SCAN VIP name: scan3, IP: /myscan.earth.com/172.43.22.89
16. Update the SCAN Listener with new SCAN VIPs identified from DNS
oracle@lnx01[GRID]:/app/oracle> srvctl modify scan_listener -u
17. Verify new SCAN Listeners registered for new SCAN VIPs
oracle@lnx01[GRID]:/app/oracle> srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521
18. Start SCAN Listener NOTE: This will also start the SCAN VIPs
oracle@lnx01[GRID]:/app/oracle> srvctl start scan_listener
19. Verify Status of all three SCAN VIPs have been enabled and are running.
oracle@lnx01[GRID]:/app/oracle> srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node lnx02
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running on node lnx01
SCAN VIP scan3 is enabled
SCAN VIP scan3 is running on node lnx01
20. Verify Status of all three SCAN Listeners have been enabled and are running.
oracle@lnx01[GRID]:/app/oracle> srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node lnx02
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node lnx01
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node lnx01