Oracle 11gR2 SCAN Configuration

11gR2 has introduced a new concept, SCAN (Single Client Access Name).

Normally used in RAC environment, provides a single name for clients to access an Oracle Database running in a cluster (In prior versions, tnsnames.ora entries will have all nodes in connect strings).

1) To check if the scan listener host is correctly setup in DNS

# nslookup myscan.mydomain.com
Server: x.x.x.101
Address: x.x.x.101#53

Name: myscan.mydomain.com
Address: x.x.x.182
Name: myscan.mydomain.com
Address: x.x.x.183
Name: myscan.mydomain.com
Address: x.x.x.184

2) Round robin check (Ideally should resolve to different addresses)

# ping myscan.mydomain.com
PING myscan.mydomain.com (x.x.x.183) 56(84) bytes of data.
64 bytes from myscan.mydomain.com (x.x.x.183): icmp_seq=1 ttl=64 time=0.094 ms
64 bytes from myscan.mydomain.com (x.x.x.183): icmp_seq=2 ttl=64 time=0.088 ms
^C
— myscan.mydomain.com ping statistics —
2 packets transmitted, 2 received, 0% packet loss, time 1006ms
rtt min/avg/max/mdev = 0.088/0.091/0.094/0.003 ms

# ping myscan.mydomain.com
PING myscan.mydomain.com (x.x.x.184) 56(84) bytes of data.
64 bytes from myscan.mydomain.com (x.x.x.184): icmp_seq=1 ttl=64 time=0.027 ms
64 bytes from myscan.mydomain.com (x.x.x.184): icmp_seq=2 ttl=64 time=0.034 ms
^C
— myscan.mydomain.com ping statistics —
2 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 0.027/0.042/0.065/0.016 ms

# ping myscan.mydomain.com
PING myscan.mydomain.com (x.x.x.182) 56(84) bytes of data.
64 bytes from myscan.mydomain.com (x.x.x.182): icmp_seq=1 ttl=64 time=0.097 ms
64 bytes from myscan.mydomain.com (x.x.x.182): icmp_seq=2 ttl=64 time=0.459 ms
^C
— myscan.mydomain.com ping statistics —
2 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 0.095/0.217/0.459/0.171 ms

3) Check which scan listener is running on which node in the cluster

Here

LISTENER_SCAN1 is ONLINE on labsx86-1
LISTENER_SCAN2 is ONLINE on labsx86-2
LISTENER_SCAN3 is ONLINE on labsx86-2

Similarly scan VIP’s are also available on same corresponding hosts

scan1.vip is ONLINE on labsx86-1
scan2.vip is ONLINE on labsx86-2
scan3.vip is ONLINE on labsx86-2

4) Check which port the SCAN is using

$ srvctl config scan_listener

SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1522
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1522
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1522

5) Check which IP addresses SCAN VIP’s are using

$ srvctl config scan

SCAN name: myscan.mydomain.com, Network: 1/x.x.x.0/x.x.x.0/eth0
SCAN VIP name: scan1, IP: /myscan.mydomain.com/x.x.x.184
SCAN VIP name: scan2, IP: /myscan.mydomain.com/x.x.x.182
SCAN VIP name: scan3, IP: /myscan.mydomain.com/x.x.x.183

6) Check SCAN listener status

NOTE: This has to be executed as GRID user

$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 – Production on 21-MAY-2010 11:50:38

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
————————
Alias LISTENER_SCAN1
Version TNSLSNR for Linux: Version 11.2.0.1.0 – Production
Start Date 20-MAY-2010 19:11:30
Uptime 0 days 16 hr. 39 min. 7 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oragrid/network/admin/listener.ora
Listener Log File /oragrid/log/diag/tnslsnr/labsx86-1/listener_scan1/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=x.x.x.184)(PORT=1522)))
Services Summary…
Service “SWDB” has 2 instance(s).
Instance “SWDB1”, status READY, has 1 handler(s) for this service…
Instance “SWDB2”, status READY, has 1 handler(s) for this service…
Service “SWDBXDB” has 2 instance(s).
Instance “SWDB1”, status READY, has 1 handler(s) for this service…
Instance “SWDB2”, status READY, has 1 handler(s) for this service…
The command completed successfully

7) Check services & instances associated with SCAN

NOTE: This has to be executed as GRID user

$ lsnrctl service LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 – Production on 21-MAY-2010 11:49:00

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
Services Summary…
Service “SWDB” has 2 instance(s).
Instance “SWDB1”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:2 refused:0 state:ready
REMOTE SERVER
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=labsx86-1-vip)(PORT=1521)))
Instance “SWDB2”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:ready
REMOTE SERVER
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=labsx86-2-vip)(PORT=1521)))
Service “SWDBXDB” has 2 instance(s).
Instance “SWDB1”, status READY, has 1 handler(s) for this service…
Handler(s):
“D000” established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER gt;
(ADDRESS=(PROTOCOL=tcp)(HOST=labsx86-1)(PORT=22254))
Instance “SWDB2”, status READY, has 1 handler(s) for this service…
Handler(s):
“D000” established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER gt;
(ADDRESS=(PROTOCOL=tcp)(HOST=labsx86-2)(PORT=20712))
The command completed successfully

8) How to connect from the client, using SCAN

Sample tnsnames.ora entry, which points to scan as hostname

SWDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myscan.mydomain.com)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = SWDB)
)
)

Advertisements
This entry was posted in Oracle Real Application Cluster and tagged . Bookmark the permalink.

3 Responses to Oracle 11gR2 SCAN Configuration

  1. Michael Elkin says:

    I found that i have to setup a remote listener for a scan alias and port

    alter system set remote_listener=’scan_name:scan_port’;

  2. Pingback: 2010 in review | Oracle-Hands-On

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s