今天发现Windows 2003server上的Oracle 监听器无法启动,在Windows服务里启动后立即停止,在cmd环境下执行lsnrctl start命令会报ora-12542错误。
实际上以上监听器异常现象在前几天偶尔出现,后来监听器端口被占用原因,应用系统所对应的数据库用户无法链接数据库。
处理过程:
1、重建监听器没有用,重启服务器后也是没法连接数据库(sys / as sysdba可以连接,并可以正常启动和关闭数据库);
2、因数据库小,因此先备份(expdp)好数据后重新安装Oracle并重建数据库,还是不行。[@more@]
3、以上方法都失败后,我开始搜索网络,如下是从中得到metalink解答内容,解释很好:
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.
Solution
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.
这主要是由于操作系统的临时端口不够用而引起的。一般系统的临时端口为 1024-5000,这在多用户的环境下,3000多个oracle链接就用光了。由于每个链接断开以后,还要有一个等待时间,例如在 windows 系统中,这个时间是 120秒。
这就导致了一个现象:一会可以联通,一会又出现ora-12542 address in used。如果有临时端口可以使用,可以联通oracle;如果暂时端口没有了,就连不通了。
一下是在windows系统下的解决办法。
1、进入注册表编辑器(regedit),在 HKEY_LOCAL_MACHINEsystemCurrentControlSetServicesTcpipParameters 里,编译-> 添加-> MaxUserPort (类型 REG_DWORD ), 值中填写 65534,(十进制,可以的范围是5000-65534).
2、退出 注册表编辑器,重新启动机器.
1515

被折叠的 条评论
为什么被折叠?



