连接oralce时, 
ORA-12542: TNS: 地址已被占用
ORA-12560: TNS: 协议适配器错误
这两个错误 替换着报,说不定报哪个。有的时候连接又成功了。我初步判断。可能跟我一个.NET的程序有关。
那个程序会频繁的打开和关闭连接。请教该怎么解决。

解决方案 »

  1.   

    把你服务器的 listener.ora 和 客户端的 tnsnames.ora 弄出来看看
      

  2.   

    ORA-12542: TNS: 地址已被占用
    ORA-12560: TNS: 协议适配器错误
    CauseITPUB个人空间 L*{\B.{"aSz:I)@
            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.ITPUB个人空间V \[:Y0^
            SolutionITPUB个人空间F$P+SxR
            There are 2 solutions available:
    xP'~L/\|0        1.) Increase the free port range:ITPUB个人空间-OWVwS+g6K b*G
                  ======================ITPUB个人空间%q:u7usE8[{
                  Start Registry Editor (Regedt32.exe).ITPUB个人空间;a)};f S2Lp
                   Locate the following key in the registry:ITPUB个人空间3V-]%G;cO0XY
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
    %H"Wh8o.Zy0
    il7Vt s!_Tg.d0        On the Edit menu, click Add Value, and then add the following registry value:ITPUB个人空间vi8?N4eTI)U"g
            Value Name: MaxUserPort Data Type: REG_DWORD Value: 65534ITPUB个人空间j$TL[Z|_L'Q
            Valid Range: 5000-65534 (decimal) Default: 0x1388 (5000 decimal)
    0yNdyH0ITPUB个人空间 ET+GR)oT-H P~
            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.ITPUB个人空间h#K!}XSg)pA7I"S*mOEW%xl0        2.) Decrease the value for TIME_WAIT state:ITPUB个人空间#me hEUpojd B
            ================================ITPUB个人空间 O&i1VV#w9N
           TcpTimedWaitDelay (new in Windows NT versions 3.51 SP5 and later)ITPUB个人空间1es,T0Qz/D5ci5e:l$L#jF'x
           Key: Tcpip\ParametersITPUB个人空间\v#~(B O4S
           Value Type: REG_DWORD - Time in seconds
    xVD2I4B6YZP3u0       Valid Range: 30-300 (decimal)ITPUB个人空间6qK&P2E6|a9ON
           Default: 0xF0 (240 decimal)
    |7U"B?n]0yl0ITPUB个人空间'B"Y/g'W7@WV'Nd
           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.ITPUB个人空间'o.j#J W7HP2Ry \nBo9W)? E3dG U0ITPUB个人空间\d-F B:k6i;{
            方法提交给了开发人员,看看情况ITPUB个人空间"UW N;c6R;P8B4bKD%z%]-?yQ9l M0       下午去看了一下机器,发现大量 time_wait的连接,查了一下listener的日志,应用程序大量开连接,关闭不及时
    2^u8QHk7h|0
    C P7y;z7v0S+U.b0        看来本次的诊断是对症的,修改的注册表,看看情况
    2g8[nCP0a8Ts0r S}0
    'h8[iVZ7n1A&MK0        ps:俩天了,系统还没出过问题,看来对症了ITPUB个人空间%vqJH LI-KAO
      

  3.   

    http://space.itpub.net/3326/viewspace-607363