The docs note this on the ORA-12542 error:
ORA-12542: TNS:address already in use
Cause: Specified listener address is already being used.
Action: Start your listener with a unique address.
In UNIX, the ORA-12542 error is an easy fix, just re-set the listener
to run on a different port or add to the queue size for the listener
in your listener.ora file.
listener=(address=
(protocol=tcp)
(host=myhost)
(port=2241)
(queuesize=60)
Fixing the ORA-12542 on Windows
The error "ORA-12542: TNS:address already in use" is rare on UNIX but
very common on Windows crapware and /net platforms, 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.
On Windows, user SJH suggests this solution for the ORA-12542 error:
[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 2 solutions available:
1.) Increase the free port range:
======================
Start Registry Editor (Regedt32.exe).
Locate the following key in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip
\Parameters
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: Tcpip\Parameters
Value Type: REG_DWORD - Time in seconds
Valid Range: 30-300 (decimal)
Default: 0xF0 (240 decimal)