怎样解决 ora-12542 address in used 错误?

解决方案 »

  1.   


    Ensure that the port number specified in the listener.ora. and the tnsnames.ora is not already in use. You may also get this error if you shut the listener down for any reason, and then try to start it back up. Basically your errors 12542 indicates that the listener port is already in use by another application. Or maybe have another listener running or perhaps added another instance but it's trying to listen on the same port. Check the ports in use, make appropriate corrections to listener.ora and tnsnames.ora files with new port number and restart the listener. With Windows NT, do a netstat. This will search all the ports being used in your machine. If there are multiple address for 'PROTOCOL=IPC' in the same LISTENER.ORA file for a listener, make sure none of the 'KEY' parameter values are duplicated. Check if this parameter is set in the listener.ora: 
    USE_CKPFILE_LISTENER = true 
    If this setting exists, it means you are using a checkpoint file for your listener. Check the port settings in use in the file - they may be an already allocated port. If your listener.ora is correct, set this parameter to FALSE. This will keep the listener from reading the checkpoint file.
      

  2.   


    Ensure that the port number specified in the listener.ora. and the tnsnames.ora is not already in use. You may also get this error if you shut the listener down for any reason, and then try to start it back up. Basically your errors 12542 indicates that the listener port is already in use by another application. Or maybe have another listener running or perhaps added another instance but it's trying to listen on the same port. Check the ports in use, make appropriate corrections to listener.ora and tnsnames.ora files with new port number and restart the listener. With Windows NT, do a netstat. This will search all the ports being used in your machine. If there are multiple address for 'PROTOCOL=IPC' in the same LISTENER.ORA file for a listener, make sure none of the 'KEY' parameter values are duplicated. Check if this parameter is set in the listener.ora: 
    USE_CKPFILE_LISTENER = true 
    If this setting exists, it means you are using a checkpoint file for your listener. Check the port settings in use in the file - they may be an already allocated port. If your listener.ora is correct, set this parameter to FALSE. This will keep the listener from reading the checkpoint file.
      

  3.   

    这主要是由于 操作系统的 临时端口 不够用而引起的。 一般系统的 临时端口为 1024-5000,这在多用户的环境下,3000多个oracle链接就用光了。由于每个链接断开以后,还要有一个等待时间,例如在 windows 系统中,这个时间是 120秒。 
        这就导致了一个现象: 一会可以联通,一会又出现 ora-12542 address in used 。如果有临时端口可以使用,可以联通oracle;如果暂时端口没有了,就连不通了。
        一下是在 windows 系统下的解决办法。
       1 进入注册表编辑器(regedit),在 HKEY_LOCAL_MACHINE\system\CurrentControlSet\Services\Tcpip\Parameters 里,编译->添加->MaxUserPort (类型 REG_DWORD ), 值中填写 65534,(可以的范围是5000-65534).
       2 退出 注册表编辑器,重新启动机器.   这样设置, 临时端口的范围从 1024-5000,增大到 1024-65534, 足够一般用户的使用,不会再出现ora-12542.    其他系统也可以做类似的设置. 
    end!
      

  4.   

    The Ephemeral Port Range
    A TCP/IPv4 connection consists of two endpoints, and each endpoint consists of an IP address and a port number.  Therefore, when a client user connects to a server computer, an established connection can be thought of as the 4-tuple of (server IP, server port, client IP, client port).  Usually three of the four are readily known -- client machine uses its own IP address and when connecting to a remote service, the server machine's IP address and service port number are required.  What is not immediately evident is that when a connection is established that the client side of the connection uses a port number.  Unless a client program explicitly requests a specific port number, the port number used is an ephemeral port number.  Ephemeral ports are temporary ports assigned by a machine's IP stack, and are assigned from a designated range of ports for this purpose.  When the connection terminates, the ephemeral port is available for reuse, although most IP stacks won't reuse that port number until the entire pool of ephemeral ports have been used.  So, if the client program reconnects, it will be assigned a different ephemeral port number for its side of the new connection.Similarly, for UDP/IP, when a datagram is sent by a client from an unbound port number, an ephemeral port number is assigned automatically so the receiving end can reply to the sender.
      

  5.   

    AIX
    AIX uses the "no" command to set network options.  AIX uses two separate ephemeral port ranges, one for TCP and UDP, and both default to the values 32768 through 65535:# /usr/sbin/no -a | fgrep ephemeral
            tcp_ephemeral_low = 32768
           tcp_ephemeral_high = 65535
            udp_ephemeral_low = 32768
           udp_ephemeral_high = 65535
    The default range is sufficient, but you can change it using the no command.  Here is an example that sets the TCP ephemeral port range to 49152 through 65535:# /usr/sbin/no -o tcp_ephemeral_low=49152 -o tcp_ephemeral_high=65535
    The options you set with no must be done each time the system starts up.  One way to do that is to edit /etc/rc.tcpip and insert your no commands just before the script starts running the server daemons.