您的位置:首页 > 数据库 > Oracle

ORACLE连接问题.TNS-12542: TNS: 地址已被占用

2007-06-05 10:16 405 查看

TNS-12542 Error When Executing Batch Jobs or in High Transaction Environment

发表人:davies | 发表时间: 2007年一月30日, 19:39
TNS-12542 Error When Executing Batch Jobs or in High Transaction Environment

The information in this document applies to:
Oracle Net Services - Version: 8.1.7.4 to 10.1.0.0
Microsoft Windows 2000
Microsoft Windows XP (64-bit Itanium)
Microsoft Windows (32-bit)

Errors
TNS-00512 "Address already in use"
TNS-12542 TNS:address already in use
TNS-12560 "TNS:protocol adapter error"

Symptoms
TNS-12542 errors in log files when executing batch jobs or in high transaction environments. Client trace files will show

CLIENT TRACE FILE:
================

(3752) [10-JUN-2004 15:20:50:899] niotns: Calling address:
(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=tst81)(PORT=1526)))(CONNECT_DATA=(SID=sec)(SRVR=DEDICATED)(CID=(PROGRAM=c:windowssystem32inetsrvw3wp.exe)(HOST=SRVPDFTEST)(USER=userarchive))))
(3752) [10-JUN-2004 15:20:50:899] nscall: connecting...
(3752) [10-JUN-2004 15:20:50:899] nttgetport: port resolved to 1526
(3752) [10-JUN-2004 15:20:50:899] nttbnd2addr: looking up IP addr for host:tst81
(3752) [10-JUN-2004 15:20:50:899] nsopen: opening transport...
(3752) [10-JUN-2004 15:20:50:899] nttcnp: Validnode Table IN use; err 0x0
(3752) [10-JUN-2004 15:20:50:899] nttcni: trying to connect to socket 6628.
(3752) [10-JUN-2004 15:20:50:899] ntt2err: soc 6628 error - operation=1, ntresnt[0]=512, ntresnt[1]=48, ntresnt[2]=0
(3752) [10-JUN-2004 15:20:50:899] nserror: nsres: id=0, op=65, ns=12542,ns2=12560; nt[0]=512, nt[1]=48, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
(3752) [10-JUN-2004 15:20:50:899] nsopen: unable to open transport
(3752) [10-JUN-2004 15:20:50:899] nioqper: error from nscall
(3752) [10-JUN-2004 15:20:50:899] nioqper: nr err code: 0
(3752) [10-JUN-2004 15:20:50:899] nioqper: ns main err code: 12542
(3752) [10-JUN-2004 15:20:50:899] nioqper: ns (2) err code: 12560
(3752) [10-JUN-2004 15:20:50:899] nioqper: nt main err code: 512
(3752) [10-JUN-2004 15:20:50:899] nioqper: nt (2) err code: 48
(3752) [10-JUN-2004 15:20:50:899] nioqper: nt OS err code: 0
(3752) [10-JUN-2004 15:20:50:899] niqme: reporting NS-12542 error as ORA-12542
(3752) [10-JUN-2004 15:20:50:899] niomapnserror: returning error 12542
(3752) [10-JUN-2004 15:20:50:899] niotns: Couldn't connect, returning 12542
(432) [10-JUN-2004 15:20:50:899] nstimarmed: no timer allocated

SQLNET.LOG file:
=============
Fatal NI connect error 12542, connecting to:

(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=tst81)(PORT=1526))(CONNECT_DATA=(SID=sec)(SRVR=DEDICATED)(CID=(PROGRAM=c:windowssystem32inetsrvw
3wp.exe)(HOST=SRVPDFTEST)(USER=userarchive))))

VERSION INFORMATION:
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 9.2.0.1.0 - Production
Time: 10-JUN-2004 15:20:50
Tracing to file: E:oracleora92tempcli_1732.trc
Tns error struct:
nr err code: 0
ns main err code: 12542
TNS-12542: TNS:address already in use
ns secondary err code: 12560
nt main err code: 512
TNS-00512: Address already in use
nt secondary err code: 48
nt OS err code: 0
Cause
Problem is caused due to the fact that the free ports in the windows client has been exhausted and it is trying to make use of a port which is in TIME_WAIT state which gives the error TNS-12542: Address already in use.
Fix
There are 2 solutions available:

1.) Increase the free port range:
======================
Start Registry Editor (Regedt32.exe).

Locate the following key in the registry:

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParameters

On the Edit menu, click Add Value, and then add the following registry value:

Value Name: MaxUserPort Data Type: REG_DWORD Value: 65534

Valid Range: 5000-65534 (decimal) Default: 0x1388 (5000 decimal)

Description: This parameter controls the maximum port number used when an application requests any
available user port from the system. Normally, ephemeral (that is, short-lived) ports are allocated between the values of 1024 and 5000 inclusive.

2.) Decrease the value for TIME_WAIT state:
================================

TcpTimedWaitDelay (new in Windows NT versions 3.51 SP5 and later)
Key: TcpipParameters
Value Type: REG_DWORD - Time in seconds
Valid Range: 30-300 (decimal)
Default: 0xF0 (240 decimal)

Description: This parameter determines the length of time that a connection will stay in the TIME_WAIT state when being closed. While a connection is in the TIME_WAIT state, the socket pair
cannot be re- used. This is also known as the "2MSL" state, as by RFC the value should be twice
the maximum segment lifetime on the network. See RFC793 for further details.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐