Oracle11gr2網路配置新增TRANSPORT_CONNECT_TIMEOUT引數

yangtingkun發表於2010-05-16

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.ora
TEST =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.3.23)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = TESTA)
      (SERVER = DEDICATED)
    )
  )

TEST112_SHARE =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.230)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = TEST112XDB)
      (SERVER = SHARED)
    )
  )

下面透過11.2sqlplus連線配置的TEST服務名:

[oracle@bjtest ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on 星期三 5 5 06:29:59 2010

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

SQL> set time on
06:30:07 SQL> conn test/test@test
ERROR:
ORA-12170: TNS:
連線超時


06:31:14 SQL>

很明顯連線超時需要等待一分鐘的時間。

同樣透過tnsping命令也可以看到相似的結果:

[oracle@bjtest admin]$ tnsping test

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 05-5 -2010 06:30:44

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

已使用的引數檔案:


已使用 TNSNAMES 介面卡來解析別名
嘗試連線 (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.3.23)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = TESTA) (SERVER = DEDICATED)))
TNS-12535: TNS:
操作超時
[oracle@bjtest admin]$ date
Wed May  5 06:31:48 CST 2010

下面修改TEST服務名的配置,新增TRANSPORT_CONNECT_TIMEOUT引數:

[oracle@bjtest admin]$ vi tnsnames.ora

TEST =
  (DESCRIPTION =
    (TRANSPORT_CONNECT_TIMEOUT = 5)
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.3.23)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = TESTA)
      (SERVER = DEDICATED)
    )
  )

TEST112_SHARE =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.230)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = TEST112XDB)
      (SERVER = SHARED)
    )
  )
~
"tnsnames.ora" 53L, 1086C written

再次透過SQLPLUS連線:

06:32:52 SQL> conn test/test@test
ERROR:
ORA-12170: TNS:
連線超時


06:33:05 SQL>

這次很短的時間很就超時報錯並返回結果了。

執行tnsping的結果觀察的更明顯一些:

[oracle@bjtest admin]$ tnsping test

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 05-5 -2010 06:33:16

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

已使用的引數檔案:


已使用 TNSNAMES 介面卡來解析別名
嘗試連線 (DESCRIPTION = (TRANSPORT_CONNECT_TIMEOUT = 5) (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.26.3.23)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = TESTA) (SERVER = DEDICATED)))
TNS-12535: TNS:
操作超時
[oracle@bjtest admin]$ date
Wed May  5 06:33:24 CST 2010

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4227/viewspace-662832/,如需轉載,請註明出處,否則將追究法律責任。

相關文章