oracle12542故障原因,ORACLE连接问题.TNS-12542: TNS: 地址已被占用

本文介绍了解决Oracle客户端出现TNS-12542错误的方法,该错误通常发生在批量作业执行或高并发环境中。文章提供了两种解决方案:一是增加可用端口范围;二是减少TIME_WAIT状态的时间。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

发表人: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 paircannot be re- used. This is also known as the "2MSL" state, as by RFC the value should be twicethe maximum segment lifetime on the network. See RFC793 for further details.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值