Scan and Node TNS Listener

11.2 Scan and Node TNS Listener Setup Examples [ID 1070607.1]

 Modified 15-FEB-2011     Type HOWTO     Status PUBLISHED 

In this Document
  Goal
  Solution
  References


Applies to:

Oracle Net Services - Version: 11.2.0.1 and later   [Release: 11.2 and later ]
Information in this document applies to any platform.

Goal

Document to show 11.2 Scan and Node TNS listener examples for RAC, along with client trace connection, showing possible route taken to database from client.  

Solution

Example for 2 Node cluster with 2 Scan listeners running, with following details:

Ipaddress        Hostname
--------------   -------------------------------------
Scan Addresses:
11.111.111.11    netrac-scan netrac-scan.uk.oracle.com
22.222.222.22    netrac-scan netrac-scan.uk.oracle.com

Node Addresses:
12.345.678.111   netrac1 netrac1.uk.oracle.com
12.345.678.222   netrac2 netrac2.uk.oracle.com

Node VIP's
12.345.678.888   netrac1-vip netrac1-vip.uk.oracle.com
12.345.678.999   netrac2-vip netrac2-vip.uk.oracle.com


Database called "v11gr2"
Scan listeners called LISTENER_SCAN1 and LISTENER_SCAN2
(Most configurations will have upto 3 SCAN listeners configured)
DNS setup for the scan address to resolve to 11.111.11.11 or 22.222.222.22
C:\>nslookup netrac-scan.uk.oracle.com
Server: dns001.uk.oracle.com
Address: 10.10.1.0

Name: netrac-scan.uk.oracle.com
Addresses: 11.111.111.11, 22.222.222.22

Node 1.

SCAN listener "LISTENER_SCAN1" is currently running on Node 1.
Both the SCAN and Node listeners run from the grid oracle home. This the recommend setup.
[grid@netrac1 admin]$ ps -ef |grep tnslsnr
grid 9185 1 0 10:57 ? 00:00:00 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
grid 9707 9061 0 11:09 pts/3 00:00:00 grep tnslsnr
grid 10762 1 0 Feb08 ? 00:03:19 /u01/app/11.2.0/grid/bin/tnslsnr listener_scan1 -inherit

Database parameter LOCAL_LISTENER points to Node VIP address

SQL> show parameter local_listener

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=netrac1-vip)(PORT=1521))))

Database Parameter REMOTE_LISTENER points to SCAN name

SQL> show parameter remote_listener

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_listener string netrac-scan.uk.oracle.com:1521

Listener.ora

[grid@netrac1 admin]$ more listener.ora
LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))) # line added by Agent
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))# line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON # line added by Agent

The ENABLE_GLOBAL_DYNAMIC_ENDPOINT_ parameter is set to allow the listener to accept connections for pre-11.2 databases which did not register the dynamic endpoint.

Listener status "listener" showing 1 instance registered, ie instance running on the node

[grid@netrac1 admin]$ lsnrctl status listener
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 15-FEB-2011 10:57:09
Uptime 0 days 0 hr. 0 min. 46 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/netrac1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12.345.678.111)(PORT=1521))) ** Node IP Address **
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12.345.678.888)(PORT=1521))) ** Node VIP Address **
Services Summary...
Service "v11gr2" has 1 instance(s).
Instance "v11gr21", status READY, has 2 handler(s) for this service...
The command completed successfully

New file for 11.2 called endpoints_listener.ora, showing the Node IP address and Node VIP address.

[grid@netrac1 admin]$ more endpoints_listener.ora
LISTENER_NETRAC1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=netrac1-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=12.345.678.888)(PORT=1521)(IP=FIRST)))) # line added by Agent

Endpoints_listener.ora file is there for backward compatibility with pre-11.2 databases.
DBCA needs to know the endpoints location to configure database parameters and tnsnames.ora file.
It used to use the listener.ora file, 11.2 RAC listener.ora by default only has IPC entries.

Listener status "listener_scan1" showing both instances registered from the nodes.

[grid@netrac1 admin]$ lsnrctl status listener_scan1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-FEB-2011 11:04:46

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 08-FEB-2011 15:46:52
Uptime 6 days 19 hr. 17 min. 53 sec
Trace Level support
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0/grid/network/log/listener_scan1.log
Listener Trace File /u01/app/11.2.0/grid/network/trace/listener_scan1.trc
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11.111.111.11)(PORT=1521))) ** Scan VIP **
Services Summary...
Service "v11gr2" has 2 instance(s).
Instance "v11gr21", status READY, has 3 handler(s) for this service...
Instance "v11gr22", status READY, has 2 handler(s) for this service...
The command completed successfully

Node 2.
SCAN listener "LISTENER_SCAN2" is currently running on Node 2, along with node listener "listener"

[grid@netrac2 ~]$ ps -ef |grep tnslsnr
grid 4466 1 0 Feb07 ? 00:00:11 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER -inherit
grid 4481 1 0 Feb07 ? 00:00:13 /u01/app/11.2.0/grid/bin/tnslsnr LISTENER_SCAN2 -inherit
grid 32059 31690 0 11:08 pts/1 00:00:00 grep tnslsnr

Database parameter LOCAL_LISTENER points to Nodes VIP address

SQL> show parameter local_listener

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=netrac2-vip)(PORT=1521))))

Database Parameter REMOTE_LISTENER points to SCAN name.

SQL> show parameter remote_listener

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_listener string netrac-scan.uk.oracle.com:1521

Listener.ora

[grid@netrac2 admin]$ more listener.ora
LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))) # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))) # line added by Agent
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))# line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON # line added by Agent

"Line added by Agent" is the Oraagent is the process updating the listener.ora and endpoints_listener.ora files.

Endpoints_listener.ora showing the Node IP address and Node VIP address

[grid@netrac2 admin]$ more endpoints_listener.ora
LISTENER_NETRAC2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=netrac2-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=12.345.678.999) (PORT=1521)(IP=FIRST)))) # line added by Agent

Listener status "listener" showing 1 instance registered

[grid@netrac2 admin]$ lsnrctl status listener

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-FEB-2011 11:24:28

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 07-FEB-2011 10:48:06
Uptime 8 days 0 hr. 36 min. 22 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/netrac2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12.345.678.222)(PORT=1521))) **Node IP Address**
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12.345.678.999)(PORT=1521))) **Node VIP Address**
Services Summary...
Service "v11gr2" has 1 instance(s).
Instance "v11gr22", status READY, has 2 handler(s) for this service...
The command completed successfully

Listener status "listener_scan2" showing both instances registered
[grid@netrac2 admin]$ lsnrctl status listener_scan2

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-FEB-2011 11:32:14

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2)))
STATUS of the LISTENER
------------------------
Alias LISTENER_SCAN2
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 07-FEB-2011 10:48:06
Uptime 8 days 0 hr. 44 min. 7 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0/grid/log/diag/tnslsnr/netrac2/listener_scan2/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN2)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=22.222.222.22)(PORT=1521)))** Scan VIP **
Services Summary...
Service "v11gr2" has 2 instance(s).
Instance "v11gr21", status READY, has 3 handler(s) for this service...
Instance "v11gr22", status READY, has 2 handler(s) for this service...
The command completed successfully

Further information on the listeners can be found via svrctl

[grid@netrac1 admin]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521

[grid@netrac1 admin]$ srvctl config scan
SCAN name: netrac-scan.uk.oracle.com, Network: 1/10.167.20.50
.240.0/255.255.240.0/eth1
SCAN VIP name: scan1, IP: /netrac-scan.uk.oracle.com/11.111.111.11
SCAN VIP name: scan2, IP: /netrac-scan.uk.oracle.com/22.222.222.22

Configuration changes to the Listener are made via svrctl

Note 952903.1 How to update the IP address of the SCAN VIP resources (ora.scan.vip)
Note 975457.1 How to Troubleshoot Connectivity Issue with 11gR2 SCAN Name
Note 972500.1 How to Modify SCAN Setting after Installation

Client connection example

C:\Documents and Settings\sflood>sqlplus scott/tiger@netscan

SQL*Plus: Release 11.2.0.1.0 Production on Tue Feb 15 11:43:02 2011

Copyright (c) 1982, 2010, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management,
Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
v11gr22

Calling address used 

15-FEB-2011 11:43:02:703] niotns: Calling address: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=netrac-scan.uk.oracle.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=v11gr2)(CID=(PROGRAM=c:\Oracle\RDBMS112\bin\sqlplus.exe)(HOST=sflood-uk)(USER=sflood))))

Resolve the Scan address and build connection information on address information supplied by DNS

[15-FEB-2011 11:43:02:703] nlad_expand_hst: Expanding netrac-scan.uk.oracle.com
[15-FEB-2011 11:43:02:703] snlinGetAddrInfo: entry
[15-FEB-2011 11:43:02:734] snlinGetAddrInfo: exit
[15-FEB-2011 11:43:02:734] snlinGetNameInfo: entry
[15-FEB-2011 11:43:02:734] snlinGetNameInfo: exit
[15-FEB-2011 11:43:02:734] nlad_expand_hst: Adding IP 11.111.111.11
[15-FEB-2011 11:43:02:734] snlinGetNameInfo: entry
[15-FEB-2011 11:43:02:734] snlinGetNameInfo: exit
[15-FEB-2011 11:43:02:734] nlad_expand_hst: Adding IP 22.222.222.22
[15-FEB-2011 11:43:02:734] snlinFreeAddrInfo: entry
[15-FEB-2011 11:43:02:734] snlinFreeAddrInfo: exit
[15-FEB-2011 11:43:02:734] nlad_expand_hst: Result: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=11.111.111.11)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=22.222.222.22)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=v11gr2)(CID=(PROGRAM=c:\Oracle\RDBMS112\bin\sqlplus.exe)(HOST=sflood-uk)(USER=sflood))))

Selected Node 1

[15-FEB-2011 11:43:02:734] nsc2addr: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=11.111.111.11)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=v11gr2)(CID=(PROGRAM=c:\Oracle\RDBMS112\bin\sqlplus.exe)(HOST=sflood-uk)(USER=sflood))))
[15-FEB-2011 11:43:02:734] nttbnd2addr: entry
[15-FEB-2011 11:43:02:734] snlinGetAddrInfo: entry
[15-FEB-2011 11:43:02:734] snlinGetAddrInfo: exit
[15-FEB-2011 11:43:02:734] nttbnd2addr: using host IP address: 11.111.111.11

Start of the connection handshake 

[15-FEB-2011 11:43:02:734] nscon: doing connect handshake...
[15-FEB-2011 11:43:02:734] nscon: sending NSPTCN packet

Redirect packet from Scan TNS listener 

[15-FEB-2011 11:43:02:859] nscon: got NSPTRD packet

Connection told to redirect to Node 2 Node listener 

[15-FEB-2011 11:43:02:859] nsc2addr: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=netrac2-vip)(PORT=1521)))

Connection handshake completed (Connect, Resend, Connect, Accept)

[15-FEB-2011 11:43:02:890] nscon: doing connect handshake...
[15-FEB-2011 11:43:02:890] nscon: sending NSPTCN packet

[15-FEB-2011 11:43:02:921] nscon: got NSPTRS packet

[15-FEB-2011 11:43:02:921] nscon: sending NSPTCN packet

[15-FEB-2011 11:43:02:921] nscon: got NSPTAC packet

After authentication and banner packets pass, we see the select run "nsbasic_bsd" = send

[15-FEB-2011 11:43:11:953] nsbasic_bsd: 00 00 00 00 00 00 00 00 |........|
[15-FEB-2011 11:43:11:953] nsbasic_bsd: 24 73 65 6C 65 63 74 20 |$select.|
[15-FEB-2011 11:43:11:953] nsbasic_bsd: 69 6E 73 74 61 6E 63 65 |instance|
[15-FEB-2011 11:43:11:953] nsbasic_bsd: 5F 6E 61 6D 65 20 66 72 |_name.fr|
[15-FEB-2011 11:43:11:953] nsbasic_bsd: 6F 6D 20 76 24 69 6E 73 |om.v$ins|
[15-FEB-2011 11:43:11:953] nsbasic_bsd: 74 61 6E 63 65 01 00 00 |tance...|

And the information received "nsbasic_brc" = receive 

[15-FEB-2011 11:43:11:953] nsbasic_brc: 00 00 0D 49 4E 53 54 41 |...INSTA|
[15-FEB-2011 11:43:11:953] nsbasic_brc: 4E 43 45 5F 4E 41 4D 45 |NCE_NAME|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 00 00 00 00 00 00 00 00 |........|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 00 00 00 00 00 00 07 00 |........|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 00 00 07 78 6F 02 0F 0C |...xo...|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 2F 28 00 00 00 00 E8 1F |/(......|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 00 00 33 00 00 00 33 00 |..3...3.|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 00 00 00 00 00 00 06 22 |......."|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 01 00 00 00 00 00 01 00 |........|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 00 00 00 00 00 00 00 00 |........|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 00 00 00 00 07 07 76 31 |......v1|
[15-FEB-2011 11:43:11:968] nsbasic_brc: 31 67 72 32 32 08 06 00 |1gr22...|
[15-FEB-2011 11:43:11:968] nsbasic_brc: BE 7C FC 02 00 00 00 00 |.|......|

TNSNAMES.ORA entry only now needs to have the Scan name

NETSCAN =
(DESCRIPTION =
  (ADDRESS_LIST =
   (ADDRESS = (PROTOCOL = TCP)(HOST = netrac-scan.uk.oracle.com)(PORT = 1521))
  )
(CONNECT_DATA =
  (SERVICE_NAME = v11gr2)
  )
)

Pre 11.2 clients will need to the use the SCAN VIP addresses,as they do not contain the code to understand the two addresses returned by DNS, a thus connections would not load balance correctly. 

SDU and Scan

As SCAN listener information is altered via srvctl via grid oracle home, then SDU can be change for all Oracle Net connections with the profile parameter DEFAULT_SDU_SIZE in the SQLNET.ORA file.

[Insert note here]

References

NOTE:948456.1 - Pre 11.2 Database Issues in 11gR2 Grid Infrastructure Environment
请使用浏览器的分享功能分享到微信等