10g RAC监听器配置文件listener.ora中的IP=FIRST
上一篇 / 下一篇 2012-02-09 17:00:22 / 个人分类:Oracle RAC
What is IP=FIRST in the LISTENER.ORA file ? [ID 300729.1] | |||||
| |||||
修改时间 30-SEP-2011 类型 BULLETIN 状态 PUBLISHED |
In this DocumentITPUB个人空间S Y"|fg$y6WQ:U2T
Purpose
%c&L0a.]%]3c,u0 Scope and ApplicationITPUB个人空间,y+zy K R:A
What is IP=FIRST in the LISTENER.ORA file ?
;tQE.f6fa)U0 ReferencesITPUB个人空间_NGWb*w4t3l:Q
Applies to:
Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.2.0.3 - Release: 10.1 to 11.2Information in this document applies to any platform.
Checked for relevance on 30-SEP-2011.
Purpose
Starting with Oracle10g 10.1.0.3 you will see the property IP=FIRST in the LISTENER.ORA file. What is IP=FIRST used for ?LISTENER_VENUS =ITPUB个人空间%tjXa!F H3LF
(DESCRIPTION_LIST =
x8~\8o5](C J0 (DESCRIPTION =ITPUB个人空间}#n|2_/BL!e*l
(ADDRESS_LIST =ITPUB个人空间Py.wbA9|q]P
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode1-vip)(PORT = 1521)(IP = FIRST))
:U6nWir0W q!h7ng0 (ADDRESS = (PROTOCOL = TCP)(HOST = racnode1)(PORT = 1521)(IP = FIRST))ITPUB个人空间Z:HQ^(K1C2t0a!Ya3VZUn
)
zx)~:|sF0 )
(SPAN8`(RVY0 )
-i^ D tW6w0
Scope and Application
This note is intended to clarify usage for the IP=FIRST statement, usually in RAC setups.What is IP=FIRST in the LISTENER.ORA file ?
The (IP=FIRST) statement will make the listener create a listening endpoint on the IP address to which the given HOST resolves. By default, without (IP=FIRST) , the listener will listen on all network interfaces (e.g. INADDR_ANY ) — see Note 421305.1 for background information on listener binding behavior.References
NOTE:421305.1 - How The Listener Binds On TCP Protocol Addresses9R{t9vr pdJ0 ITPUB个人空间0h%dj7a4Oqfq
ITPUB个人空间h Y0gz'Z s,B,}q
*k#s.\rPF#s.XeIB0 后台的工作原理(算法):ITPUB个人空间?r |Vw|Vx&O
How The Listener Binds On TCP Protocol Addresses [ID 421305.1] | |||||
| |||||
修改时间 11-JAN-2012 类型 BULLETIN 状态 PUBLISHED |
In this DocumentITPUB个人空间 R9{m6W5qsO
PurposeITPUB个人空间~0gDh2NzL$l
Scope and Application
2U#~RyA5\1m d0 How The Listener Binds On TCP Protocol Addresses
:R aji i-u;c0 IntroductionITPUB个人空间4_)p+dX)k
General algorithm
2_6P0fs\Q0[0 Interpreting listener statusITPUB个人空间X!gMLy-F,t#S
Side effectsITPUB个人空间ZClP&Qc`bnQ]
Checking tool: Please be aware that Oracle support does not support this tool nor can we assist with issues that arise in trying to compile it.
i9mPC _G#mDh#z0 ReferencesITPUB个人空间*MC(K+]6GR8~h)m6]
Applies to:
Oracle Net Services - Version: 8.1.5.0.0 to 10.2.0.1.0 - Release: 8.1.5 to 10.2Information in this document applies to any platform.
Purpose
This note attempts to explain how the listener binds to network addresses when it is configured for the TCP protocol.Scope and Application
The knowledge contained in this note will help you discern and eventually predict the listener behavior. based on the listener configuration and system settings. This documentation is limited in scope to 10gR2 and older listeners. It doesn't apply to 11gR1 and newer listener behavior.How The Listener Binds On TCP Protocol Addresses
Introduction
Starting with Oracle 8i, the listener behavior. in how it binds to IP addresses when configured with TCP protocol endpoints has changed (see Note 69026.1 for the rationale). The general rule may appear to you as being "listen on all interfaces if a hostname is specified". While this may prove correct most of the time, in particular situations the listener may behave differently.Since the listener binding point is critical for the database instances to register themselves with the listener (see Note 359277.1 ), it is important to understand what is the algorithm used by the listener to decide in what way to listen on its TCP endpoints.
General algorithm
You may use the following schema in order to interpret the listener behavior. when it comes to binding to a TCP protocol address:(1) If you provide an IP address, the listener will listen on that IP address
(2) If you provide a hostname:
(a) Oracle does a gethostbyname() on that hostname; potentially more than one IP address is returned.
?+Ot%S!Y#CmQ.q h0
'Z,HX's!m2T0The gethostbyname() library function may query the DNS server(s), the /etc/hosts file, the NIS service and perhaps other methods, based on the system configuration. How this works exactly depends on the operating system type, but usually the /etc/host.conf, /etc/nsswitch.conf and /etc/resolv.conf files are governing the functionality on the UNIX platforms.
E&K-[{7z(qk/G7PJsX0 ITPUB个人空间mJ S4K v^@!{8V
You can find the value that is expected to be given by using the ping tool (e.g. " ping <hostname>" or " ping -s <hostname>" and see what IP address will the hostname resolve to). Do not use host, nslookup or dig to find this information, since these tools will query only the DNS service and may give wrong answers in certain situations.
1f?&[M6f\0
qg lE1~0Be careful that even the ping utility may not disclose you all the information, e.g. it will not show all the addresses associated with a hostname, if there are more than one. Best choice is to use the check-lsnrbind program, attached to this note (see below section " Checking tool"). ITPUB个人空间7YWW[~:ov
F QSn,[2ie0 (b) Oracle does a gethostname() which will return the system's configured hostname.
!fO8P x'n0 ITPUB个人空间Ii7}SV+u5Z"SK
The gethostname() library function (notice the missing by particle) will return the standard hostname set for the system (or current processor, per manual pages); this is usually done at system startup. ITPUB个人空间.q%KJ&nN0S)q'gITPUB个人空间!e.^sWOg,Dx[
ITPUB个人空间!~@B0Og
You can find the value that is expected to be given by using the hostname tool, without any parameters (e.g. simply run " hostname").
z+j]x9}&t0
(c) Oracle does a gethostbyname() on the system's hostname found in the previous step (2b).
:MAl8h |EK _0
G2j0E*n#e0?rEQ;y0 (d) Oracle compares the first IP returned in (2a) to all of the IPs returned in (2c). If no match is found, then the listener will bind to the resolved IP address. The IP address is registered in the listening endpoints list.
4{ m??,W)~cv#?2R0
0Z"lh$l~!E W5NB q0— OR —
j3V g{2I9up|3m0 ITPUB个人空间z5_:aA1k@ kuf
(e) If a match is found in (2d), the listener binds on all (working) network interfaces. The fully qualified system hostname is registered in the listening endpoints list.
9b_!W q/^O+Z9s0 ITPUB个人空间a9?W%`2K u bP yW{
You may recognize that the listener has bound to all interfaces from the " netstat -an" output: if the listener is bound to all interfaces then the IP address 0.0.0.0 will be shown — it programmers' slang this is known as the INADDR_ANY address. ITPUB个人空间*?Fy3~7C1L N
nnCE)QXG(I5s&l$oY0
Interpreting listener status
You can easily judge what is the way the listener has bound to the TCP addresses from its status output: check whether the Listening Endpoints Summary lists an IP address or a hostname. If you see an IP address then the listener had bound only to that IP, but if instead you see a hostname then the listener has bound to all interfaces ( INADDR_ANY ).Let's take the following example:
$ lsnrctl status !b+_@k'Z6}/~*@2S0ITPUB个人空间5U7U`OeKbH]R7u LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 07-MAY-2007 15:29:48 6_Bxp;aUC/s0 b8J?F~0Copyright (c) 1991, 2005, Oracle. All rights reserved. n*q-y#BXR%s7ZP0ITPUB个人空间-h&w1L9C"u,W](T Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))ITPUB个人空间9b|eQ.K1BZb'Q STATUS of the LISTENERITPUB个人空间CL6?;W3s*I g l ------------------------ }g3iki$F;]N/~_3t0Alias LISTENER e {_4Fj&r0Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production j9nX7y!B~0Start Date 13-APR-2007 14:11:16ITPUB个人空间O,F$B)g5p4QM,K%~-s Uptime 24 days 1 hr. 18 min. 32 sec 2QRO/|:[GH*[ V.j0Trace Level offITPUB个人空间#b0n j\ m6r"}({$Cl Security ON: Local OS AuthenticationITPUB个人空间Ti:EjK SNMP OFF #}xQQ b{~N@@0Listener Parameter File /opt/oracle/product/10.2.0/db_1/network/admin/listener.oraITPUB个人空间%kR.UK{L(Bu Listener Log File /opt/oracle/product/10.2.0/db_1/network/log/listener.log Y:msS}0Listening Endpoints Summary...ITPUB个人空间#b4WJVT%i (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))ITPUB个人空间?q1_G_Wc (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.10)(PORT=1527)))ITPUB个人空间f:L0C*ks3] (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost.ro.oracle.com)(PORT=1521))) d-|#qno0
Side effects
Some of the operating systems (e.g. UNIX platforms) may allow multiple bindings on the same TCP port, eventually coming from different listeners, as long as the (numeric) IP addresses do not conflict. For example, you may have one listener bound on the generic INADDR_ANY address and other(s) on specific IP address(es). In this case, connections may go to different listeners based on the destination IP address, including database instance registration attempts — be sure you are able to discern the way the connections and database registrations are working in this setup.On the contrary, other operating systems (e.g. the Microsoft Windows platform), disallow having multiple bindings on the same TCP port no matter the IP addresses used, so a second attempt to bind on the same port will fail, triggering errors when starting listener(s).
Checking tool: Please be aware that Oracle support does not support this tool nor can we assist with issues that arise in trying to compile it.
In order to check for the listener binding behavior. of the Oracle listener you can use the attached C program check-lsnrbind.c . This tool needs to be run on the target server, in order to correctly identify the system hostname and to resolve the probed hostnames through the same services as the real listener.Before using it you will need to compile it, with a command similar to the following:
cc check-lsnrbind.c -o check-lsnrbind
0R1Z!_(Fsl6Q#V0
cc check-lsnrbind.c -o check-lsnrbind -lnsl ITPUB个人空间ps#z@8w!X
The syntax is simple: just give the hostnames you want to check on its command line; if you want to see the associated IP addresses, then insert the " -v " parameter first in the command line. Here are some examples:
./check-lsnrbind testITPUB个人空间!N&uNd^v2S ./check-lsnrbind test1 test2.foo.comITPUB个人空间 Z(@2us&{L ./check-lsnrbind -v mysite.domain.com
The program has been tested to compile and run on the following platforms:
- LinuxITPUB个人空间*Z |:VB!~9vS
- Sun Solaris 10 (needs "-lnsl" when compiling)
- HP-UX 11.11
- AIX 5L
- AIX 4.3
- TruUNIX Alpha 5.1B
- MS Windows with CygWin
References
NOTE:300729.1 - What is IP=FIRST in the LISTENER.ORA file ?
NOTE:359277.1 - Changing Default Listener Port Number
NOTE:69026.1 - Oracle8i and socket LISTEN operations
*e-fM:YFfOH0ITPUB个人空间Qq Z$A5Hj
check-lsnrbind.c源码可以在下载页面下载到!下面是编译check-lsnrbind出命令,执行check-lsnrbind命令检查bind的、监听的接口:
9p[.f7r Ge-g0T:KU0
1j\LG~` _c0[root@rhel1 ~]#cc check-lsnrbind.c -o check-lsnrbind
A$Tk {\N,zt0[root@rhel1 ~]#./check-lsnrbind rhel1
System hostname is: rhel1.localdomain
Checking binding for "rhel1": will listen on all interfaces
[root@rhel1 ~]#./check-lsnrbind -v rhel1
System hostname is: rhel1.localdomainITPUB个人空间;pc8p8{-m9Q|J
First IP address for system hostname: 192.168.204.111
Checking binding for "rhel1": [ 192.168.204.111* ]ITPUB个人空间3R&PSQ/X,|)c
will listen on all interfaces
l_ Y3LYs@5|0
相关阅读:
- 初识oracle SGA之参数设置 (pingley, 2012-2-06)
- 关于SGA的常用动态性能视图 (pingley, 2012-2-07)
- 详解序列(sequence) (pingley, 2012-2-07)
- NLS_LANG的设置和字符集问题 (Rodery, 2012-2-07)
- 浅谈DML阻塞(上) (realkid4, 2012-2-07)
- Oracle 备份软件 (obackup, 2012-2-08)
- undo表空间太大解决办法 (db_wjw, 2012-2-08)
- 详解同义词(synonym) (pingley, 2012-2-08)
- 详解oracle用户创建(create user)(上) (pingley, 2012-2-08)
- Oracle Sleep Time (licheng79, 2012-2-09)