Professional Documents
Culture Documents
simplify the database connection strings that an Oracle Client uses to connect to an Oracle
Cluster Database. I have received a few emails about SCAN setup issues and I have promised
that I would come up with an article addressing the following questions:
Single client access name (SCAN) is meant to facilitate single name for all Oracle clients to
connect to the cluster database, irrespective of number of nodes and node location. Until now,
we have to keep adding multiple address records in all clients tnsnames.ora, when a new node
gets added to or deleted from the cluster.
TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 15-DEC-2011 14:21:18
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
As you see above, we got to list all the addresses of all DB nodes. If the cluster has got more
than cluster nodes, we got to list each and every node out here. This need to be updated when
a new node is added or existing node is removed.
OIDDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.freeoraclehelp.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.freeoraclehelp.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac3-vip.freeoraclehelp.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac4-vip.freeoraclehelp.com)(PORT = 1521))
....
....
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oid.freeoraclehelp.com)
)
)
This is big problem when the cluster has many nodes and end user application makes
connections to the databases. SCAN would help us easily manage the DB Connection strings in
Client tnsnames.ora files. Here is how a SCAN entry would appear:
TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 15-DEC-2011 14:37:16
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
So, you would see only one SCAN ADDRESS in tnsnames.ora files no matter how many nodes in
the cluster are.
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. SCAN is on top of VIPs, but you can directly connect to the local listener if you would like to
bypass SCAN in client’s tnsnames.ora. 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.
192.168.1.25 is one of the SCAN IPs and 192.168.1.11 is the VIP of the first RAC node.
Name: scan.freeoraclehelp.com
Address: 192.168.1.25
Name: scan.freeoraclehelp.com
Address: 192.168.1.23
Name: scan.freeoraclehelp.com
Address: 192.168.1.24
[oid1@rac1 ~]$
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. Here is a quick look at Oracle documentation's load balancing flow with SCAN:
1. 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.
2. Oracle client connects using SCAN name: myscan:1521/sales.example.com
3. Client queries DNS to resolve scan_name.
4. SCAN listener selects least loaded node (node in this example)
5. The client connects to the local listener on node2. The local listener starts a dedicated
server process for the connection to the database.
6. The client connects directly to the dedicated server process on node2 and accesses
the sales2 database instance.
After the installation, two SCAN listeners would be started on one node and another SCAN
listener on another node in a two node cluster.
NAME=ora.LISTENER_SCAN2.lsnr
TYPE=ora.scan_listener.type
TARGET=ONLINE
STATE=ONLINE on rac2
NAME=ora.LISTENER_SCAN3.lsnr
TYPE=ora.scan_listener.type
TARGET=ONLINE
STATE=ONLINE on rac2
[grid@rac1 ~]$
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN1
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 15-DEC-2011 13:11:15
Uptime 0 days 2 hr. 2 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/11.2.0/11.2.0/grid/network/admin/listener.ora
Listener Log File /oracle/product/11.2.0/11.2.0/grid/log/diag/tnslsnr/rac1/listener_scan1/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.25)(PORT=1521)))
Services Summary...
Service "oid.freeoraclehelp.com" has 2 instance(s).
Instance "oid1", status READY, has 1 handler(s) for this service...
Instance "oid2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@rac1 ~]$
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN2
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 15-DEC-2011 12:38:45
Uptime 0 days 2 hr. 35 min. 19 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/11.2.0/11.2.0/grid/network/admin/listener.ora
Listener Log File /oracle/product/11.2.0/11.2.0/grid/log/diag/tnslsnr/rac2/listener_scan2/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN2)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.23)(PORT=1521)))
Services Summary...
Service "oid.freeoraclehelp.com" has 2 instance(s).
Instance "oid1", status READY, has 1 handler(s) for this service...
Instance "oid2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@rac2 ~]$lsnrctl status LISTENER_SCAN3
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN3
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 15-DEC-2011 12:38:45
Uptime 0 days 2 hr. 35 min. 21 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/11.2.0/11.2.0/grid/network/admin/listener.ora
Listener Log File /oracle/product/11.2.0/11.2.0/grid/log/diag/tnslsnr/rac2/listener_scan3/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN3)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.24)(PORT=1521)))
Services Summary...
Service "oid.freeoraclehelp.com" has 2 instance(s).
Instance "oid1", status READY, has 1 handler(s) for this service...
Instance "oid2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@rac2 ~]$
Oracle recommends three IP Addresses be used for SCAN. SCAN setup has become a big
problem for RAC Setups at home or test environments.. especially where there is no real DNS
Server in the network. If you're trying to set up 11gR2 RAC at home on VMWare, Oracle
Virtualbox, Oracle VM, Xen..etc, you probably hit this situation. Oracle 11gR2 RAC SCAN - DNS
(bind) Configuration on Linux would explain setting up a DNS daemon on one of the RAC
nodes. Of course, you wouldn’t want to run bind in your production RAC nodes. You would
have DNS Administrator add three A records for the same name, SCAN. Once DNS is set up,
make sure that all three A records are returned in nslookup.
Name: scan.freeoraclehelp.com
Address: 192.168.1.25
Name: scan.freeoraclehelp.com
Address: 192.168.1.23
Name: scan.freeoraclehelp.com
Address: 192.168.1.24
[oid1@rac1 ~]$
Grid Naming Service (GNS) is another new service introduced in Oracle RAC 11g R2. With GNS,
Oracle Cluster Software (CRS) can manage DHCP and DNS Services for the dynamic node
registration and configuration. If you’re go to use GNS for the cluster, you should set up a
different subdomain in the main DNS Server and delegate name lookups in the subdomain to
GNS. For example, if your company domain is freeoraclehelp.com, you’re going to create
grid.freeoraclehelp.com in the DNS Servers of freeoraclehelp.com and delegate lookups for
grid.freeoraclehelp.com to GNS VIP.
Once subdomain is complete, lookups for the subdomain names from the main domain would
be forwarded to GNS Services. You would be entering the subdomain name and GNS VIP during
the Grid Infrastructure installation.
Oracle 11gR2 RAC Installation with GNS, without SCAN explains the Oracle 11g R2 RAC
installation with GNS.
How to install Oracle 11g R2 RAC without SCAN Setup in DNS or GNS?
This is mostly suited in three tier web environments where end users would not connect to the
database directly and Application Servers can use Local listener Connections (10g like
connections over VIPs). So, you would not see much benefits using SCAN here. Whatever may
be your reasons, if you’d like to use SCAN from hosts file (no DNS changes or No GNS Setup),
here is how to do that.
If you would like to Install Oracle 11g R2 RAC without SCAN setup in DNS, you would need to
create an entry in /etc/hosts for the scan name to point to a different IP address (other than
Public IP, Private IP, and VIP addresses) and supply this name for SCAN Prompts during the
installation. Make sure that you pick the new IP address in the same subnet as that of VIP
addresses and that it is not currently in use.
This would let you proceed with the installation, however would hit the following error in
Cluster Verify Utility, which runs after the installation is complete. Of course, you can ignore
this error safely if you’re using SCAN entry from hosts file.
INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "scan.freeoraclehelp.com"
INFO: ERROR:
INFO: PRVF-4657 : Name resolution setup check for "scanclunm" (IP address: 192.168.1.25) failed
INFO: ERROR:
INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "scan.freeoraclehelp.com"
After the installation of the cluster with DNS SCAN name, If you need to switch from DNS SCAN
name to local /etc/hosts entry SCAN Name, here are steps. Of course, you cannot have multiple
IP addresses in hosts file. So, it would be resolved to only one IP address in this method.
1. Stop the SCAN: Source Grid home, srvctl stop scan_listener, and srvctl stop scan then.
Name: scan.freeoraclehelp.com
Address: 192.168.1.25
Name: scan.freeoraclehelp.com
Address: 192.168.1.23
Name: scan.freeoraclehelp.com
Address: 192.168.1.24
As grid user on one of the cluster nodes (not needed on both the nodes):
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN1
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 15-DEC-2011 16:10:14
Uptime 0 days 0 hr. 0 min. 25 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/11.2.0/11.2.0/grid/network/admin/listener.ora
Listener Log File /oracle/product/11.2.0/11.2.0/grid/log/diag/tnslsnr/rac2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.25)(PORT=1521)))
The listener supports no services
The command completed successfully
[grid@rac2 ~]$
After the installation of the cluster with SCAN with one IP address in /etc/hosts, If you need to
switch to DNS SCAN, here are steps.
1. Stop the SCAN: Source Grid home, srvctl stop scan_listener, and srvctl stop scan then.
2. Remove/comment the entry in /etc/hosts file for SCAN and setup a DNS name with multiple
A (three A records), if it is not already setup. I have the SCAN setup in a DNS server that runs on
the second cluster node. I just have to use it (in resolv.conf). For more information about DNS
Setup, refer to How to setup DNS for Oracle 11g R2 SCAN?
Name: scan.freeoraclehelp.com
Address: 192.168.1.25
Name: scan.freeoraclehelp.com
Address: 192.168.1.23
Name: scan.freeoraclehelp.com
Address: 192.168.1.24
As grid user on one of the cluster nodes (not needed on both the nodes):
Verify that configuration is right and three SCAN listeners are started.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN1
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 15-DEC-2011 13:11:15
Uptime 0 days 2 hr. 2 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/11.2.0/11.2.0/grid/network/admin/listener.ora
Listener Log File /oracle/product/11.2.0/11.2.0/grid/log/diag/tnslsnr/rac1/listener_scan1/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.25)(PORT=1521)))
Services Summary...
Service "oid.freeoraclehelp.com" has 2 instance(s).
Instance "oid1", status READY, has 1 handler(s) for this service...
Instance "oid2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@rac1 ~]$
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN2
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 15-DEC-2011 12:38:45
Uptime 0 days 2 hr. 35 min. 19 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/11.2.0/11.2.0/grid/network/admin/listener.ora
Listener Log File /oracle/product/11.2.0/11.2.0/grid/log/diag/tnslsnr/rac2/listener_scan2/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN2)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.23)(PORT=1521)))
Services Summary...
Service "oid.freeoraclehelp.com" has 2 instance(s).
Instance "oid1", status READY, has 1 handler(s) for this service...
Instance "oid2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@rac2 ~]$ lsnrctl status LISTENER_SCAN3
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN3
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 15-DEC-2011 12:38:45
Uptime 0 days 2 hr. 35 min. 21 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/product/11.2.0/11.2.0/grid/network/admin/listener.ora
Listener Log File /oracle/product/11.2.0/11.2.0/grid/log/diag/tnslsnr/rac2/listener_scan3/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN3)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.24)(PORT=1521)))
Services Summary...
Service "oid.freeoraclehelp.com" has 2 instance(s).
Instance "oid1", status READY, has 1 handler(s) for this service...
Instance "oid2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@rac2 ~]$
How to rename SCAN in Cluster?
After the installation of the Oracle 11g R2 cluster with SCAN, If you need to change the scan
name from scan.freeoraclehelp.com to newscan.freeoraclehelp.com, here is how.
1. Stop the SCAN: Source Grid home, srvctl stop scan_listener, and srvctl stop scan then.
2. Configure the new SCAN in your DNS, or /etc/hosts, or GNS and make sure that lookups are
working for the new name.
Name: newscan.freeoraclehelp.com
Address: 192.168.1.32
Name: newscan.freeoraclehelp.com
Address: 192.168.1.33
Name: newscan.freeoraclehelp.com
Address: 192.168.1.34
[root@rac2 ~]#
As grid user on one of the cluster nodes (not needed on both the nodes):
Verify that configuration is right and three SCAN listeners are started.
As grid user, source the grid environment to make sure $GRID_HOME/bin is in PATH and
Related Posts
Oracle 11gR2 RAC