ITPub博客

首页 > 应用开发 > IT综合 > reduce tns look up time

reduce tns look up time

原创 IT综合 作者:jametong 时间:2005-04-01 09:41:17 0 删除 编辑
Reviewer: A reader

Hi I just asked about meaning of connect_timeout... I wanted to ask somthing
more, in some servers when I try to connect such as

scott/tiger@test

if test is not defined in tnsnames.ora I get an error straight away however in
some servers it takes ages to tell me the error

which parameter defines that interval?


Followup:
look in your sqlnet.ora -- there is an entry like:

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)


so, for me, if tnsnames.ora lookup fails (no test), it'll try Oracle names
server, if that fails, it'll try the default hostname (connect to a machine
named test on a known port and try to connect to a sid named test)

that could take a while, just reduce it to tnsnames and it would fail straight
away.

实例: 

我们可以看到, 在修改sqlnet.ora的tns lookup策略之后, 在look up不存在的service_name的时候, 速度有了很大的提高.

real 0m33.083s
user 0m0.010s
sys 0m0.000s

real 0m0.015s
user 0m0.010s
sys 0m0.000s



[oracle@TzdbDataAnal ]$ more product/9.2.4/network/admin/sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES,ONAMES,HOSTNAME)
[oracle@TzdbDataAnal ]$ time tnsping tes

TNS Ping Utility for Linux: Version 9.2.0.4.0 - Production on 01-APR-2005 09:45:35

Copyright (c) 1997 Oracle Corporation. All rights reserved.

Used parameter files:
/oracle/product/9.2.4/network/admin/sqlnet.ora

TNS-03505: Failed to resolve name

real 0m33.083s
user 0m0.010s
sys 0m0.000s
[oracle@TzdbDataAnal ]$ echo "NAMES.DIRECTORY_PATH= (TNSNAMES)" >
-bash: syntax error near unexpected token `newline'
[oracle@TzdbDataAnal ]$ echo "NAMES.DIRECTORY_PATH= (TNSNAMES)" >
> product/9.2.4/network/admin/sqlnet.ora
[oracle@TzdbDataAnal ]$ more product/9.2.4/network/admin/sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES)
[oracle@TzdbDataAnal ]$ time tnsping tes

TNS Ping Utility for Linux: Version 9.2.0.4.0 - Production on 01-APR-2005 09:48:03

Copyright (c) 1997 Oracle Corporation. All rights reserved.

Used parameter files:
/oracle/product/9.2.4/network/admin/sqlnet.ora

TNS-03505: Failed to resolve name

real 0m0.015s
user 0m0.010s
sys 0m0.000s
[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/94317/viewspace-794625/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-11-23

  • 博文量
    47
  • 访问量
    280623