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

Fixing the ORA-12542 on Windows 2003

While upgrading the clients EBS 11.5.9 to and during maintenance pack patch 3480000 application we encountered this issue. (The server is running on 16 cores CPU and patch process is set to 32)

The error “ORA-12542: TNS:address already in use” is rare on UNIX but very common on Windows, and this may be a bug.  See MOSC Note:252614.1,  and search for bugs relating to ORA-12542. 
It may have to do with a memory leak. 

[The ORA-12542 TNS address in use error] 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.

There are 3 solutions available:

1.) Increase the free port range:


Start Registry Editor (Regedt32.exe).
Locate the following key in the registry:


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

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: Tcpip\Parameters

Value Type: REG_DWORD – Time in seconds

Valid Range: 30-300 (decimal)

Default: 0xF0 (240 decimal)

3.) Use of IPC protocol

If the application or failing connection (such as local batch jobs running high transactions) is local to the Database, use IPC for connectivity, rather than TCP.
The IPC protocol will allow a more intense connection load than TCP will.
See Note:29232.1 for details on IPC.

 (Doc ID 276812.1)


About this entry