分类: Oracle
2010-05-20 09:59:15
在11.2中,TNSNAMES.ORA中的配置新增了TRANSPORT_CONNECT_TIMEOUT参数。
有的时候配置TNSNAMES.ORA出错在所难免,而等待超时失败的时候十分痛苦,这一分钟的TCP超时会显得很漫长,尤其是WINDOWS环境下的SQLPLUSW工具,在这一分种内完全没有任何的响应。
现在11.2允许用户配置TNSNAMES.ORA的时候指定TRANSPORT_CONNECT_TIMEOUT参数,用来指定TCP超时的等待时间。
注意,配置这个参数要求11.2的客户端:
[oracle@bjtest admin]$ more tnsnames.oraITPUB个人空间9I J,V4Z nh!XB
TEST =ITPUB个人空间3d)b9M5k y5Q[2P
(DESCRIPTION =ITPUB个人空间7cA!m'f\6o_ V
(ADDRESS_LIST =ITPUB个人空间1N'jz)mf"{ y"j
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.3.23)(PORT = 1521))ITPUB个人空间H#j)sQP
)
Dvjh*{9266282 (CONNECT_DATA =ITPUB个人空间a$U;L b7g DV
(SERVICE_NAME = TESTA)
q-x?#vjt1\ v$m1G)D9266282 (SERVER = DEDICATED)
!ou o~^#s9266282 )
%Z:a2y7s*e ~!y+kb$i9266282 )
TEST112_SHARE =ITPUB个人空间/L,sik8~v!q#{v*]
(DESCRIPTION =
I M^/SG5a|)JZ-xC M9266282 (ADDRESS_LIST =ITPUB个人空间0x\'t@:qOS8M X
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.230)(PORT = 1521))ITPUB个人空间5FC!p$n dU8] MFp
)
4JK0ql5V$\ kP:e@K9266282 (CONNECT_DATA =ITPUB个人空间4q/]jJ|u@n
(SERVICE_NAME = TEST112XDB)ITPUB个人空间I7U#{ R c!nEl
(SERVER = SHARED)
{*_!l(W\v)h9266282 )
[*P-DOpJ;_9266282 )
下面通过11.2的sqlplus连接配置的TEST服务名:
[oracle@bjtest ~]$ sqlplus /nolog
SQL*Plus: Release
Copyright (c) 1982, 2009, . All rights reserved.
SQL> set time onITPUB个人空间@9VBXAg
06:30:07 SQL> conn test/test@testITPUB个人空间pE"h!z^ |r8j\4G#r
ERROR:ITPUB个人空间wdW,l*I*v ^/bT
ORA-12170: TNS:连接超时
y8Hc)I,~ Z%S4g926628206:31:14 SQL>
很明显连接超时需要等待一分钟的时间。
同样通过tnsping命令也可以看到相似的结果:
[oracle@bjtest admin]$ tnsping test
TNS Ping Utility for Linux: Version
Copyright (c) 1997, 2009, Oracle. All rights reserved.
已使用的参数文件:
ITPUB个人空间(Z6\ ei'O%c:I
已使用TNSNAMES适配器来解析别名ITPUB个人空间1s;NQ8h Okx0pSM6a
尝试连接(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.3.23)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = TESTA) (SERVER = DEDICATED)))ITPUB个人空间X-c]mgz;r]k
TNS-12535: TNS:操作超时
|#U%KLNKj6Pk9266282[oracle@bjtest admin]$ dateITPUB个人空间}gIq/Jc3s
Wed May 5 06:31:48 CST 2010
下面修改TEST服务名的配置,添加TRANSPORT_CONNECT_TIMEOUT参数:
[oracle@bjtest admin]$ vi tnsnames.ora
TEST =ITPUB个人空间.W[5Rs2^ j
(DESCRIPTION =
D'b]7fF%k9266282 (TRANSPORT_CONNECT_TIMEOUT = 5)ITPUB个人空间0`-J-dX3T;T
(ADDRESS_LIST =ITPUB个人空间D"WQ1MOPU
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.3.23)(PORT = 1521))
-R!J*HIxMq:e9266282 )
'K/}N:EOLK9266282 (CONNECT_DATA =ITPUB个人空间8r;h `;d#bTMB
(SERVICE_NAME = TESTA)
p8| \Q4Ch9266282 (SERVER = DEDICATED)
s1u+? UCN/t6y9266282 )ITPUB个人空间{ns+Uv t2|.k
)
TEST112_SHARE =ITPUB个人空间K CVkcQk H
(DESCRIPTION =
}4xC}$g,o{x;m9266282 (ADDRESS_LIST =ITPUB个人空间1lzr` ] _ n
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.230)(PORT = 1521))
H/eO5D7{Av[9266282 )
to*TyL4Y3Md7m9266282 (CONNECT_DATA =ITPUB个人空间q(jqP;I+BE$v
(SERVICE_NAME = TEST112XDB)ITPUB个人空间;M6m}$^T]'GJ.I
(SERVER = SHARED)ITPUB个人空间5MmIP*EMFs9u
)
X"yX%p~'R9266282 )ITPUB个人空间!n#e`2X/s#r1} d
~ITPUB个人空间 s:W2?;t5\
"tnsnames.ora"
再次通过SQLPLUS连接:
06:32:52 SQL> conn test/test@testITPUB个人空间'Dj*TZG_ u(n{
ERROR:
uP E%ix)Qq9G9266282ORA-12170: TNS:连接超时
ITPUB个人空间!x4| ]K+H
06:33:05 SQL>
这次很短的时间很就超时报错并返回结果了。
执行tnsping的结果观察的更明显一些:
[oracle@bjtest admin]$ tnsping test
TNS Ping Utility for Linux: Version
Copyright (c) 1997, 2009, Oracle. All rights reserved.
已使用的参数文件:
ITPUB个人空间/S/E(O@c|Jzh
已使用TNSNAMES适配器来解析别名ITPUB个人空间&l;T k3[D,Y
尝试连接(DESCRIPTION = (TRANSPORT_CONNECT_TIMEOUT = 5) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.3.23)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = TESTA) (SERVER = DEDICATED)))ITPUB个人空间3M vkA+zG#o
TNS-12535: TNS:操作超时ITPUB个人空间(| N#@#Rkf1i
[oracle@bjtest admin]$ dateITPUB个人空间eOT0R6~UeU#~*S?
Wed May 5 06:33:24 CST 2010