oracle地址已被占用,ORA-12542 TNS 地址已被占用
今日客戶數據庫連接報錯,在使用plsql進行數據庫連接時出現如下報錯信息:
ORA-12542 TNS 地址已被占用。
問題排查:
1 ?使用其他服務器客戶端連接數據庫正常。
2 ?只有這一臺機器連接數據庫異常
查詢相關的metalink文檔發現如下:
2016/11/22 文檔顯示
https://support.oracle.com/epmos/faces/SearchDocDisplay?_adf.ctrlstate=
eur163egx_9#SYMPTOM 1/3
TNS-12542 Error When Executing Batch Jobs or in High Transaction Environment (文檔 ID
276812.1)
In this Document
Symptoms
Cause
Solution
References
APPLIES TO:
Oracle Net Services - Version 8.1.7.4 to 11.2.0.3 [Release 8.1.7 to 11.2]
Oracle Net Services - Version 11.2.0.4 to 11.2.0.4 [Release 11.2]
Microsoft Windows (32-bit)
Checked for relevance on 30-SEP-2011
Checked for relevance on 14-MAY-2013
SYMPTOMS
TNS-12542 errors in log files when executing batch jobs or in high transaction environments. Client trace
files will show
CLIENT TRACE FILE:
================
(3752) [10-JUN-2004 15:20:50:899] niotns: Calling address:
(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=tst81)(PORT=1526)))(CONNECT_DATA=
(SID=sec)(SRVR=DEDICATED)(CID=(PROGRAM=c:\windows\system32\inetsrv\w3wp.exe)(HOST=SRVPDFTEST)
(USER=userarchive))))
(3752) [10-JUN-2004 15:20:50:899] nscall: connecting...
(3752) [10-JUN-2004 15:20:50:899] nttgetport: port resolved to 1526
(3752) [10-JUN-2004 15:20:50:899] nttbnd2addr: looking up IP addr for host:tst81
(3752) [10-JUN-2004 15:20:50:899] nsopen: opening transport...
(3752) [10-JUN-2004 15:20:50:899] nttcnp: Validnode Table IN use; err 0x0
(3752) [10-JUN-2004 15:20:50:899] nttcni: trying to connect to socket 6628.
(3752) [10-JUN-2004 15:20:50:899] ntt2err: soc 6628 error - operation=1, ntresnt[0]=512, ntresnt[1]=48,
ntresnt[2]=0
(3752) [10-JUN-2004 15:20:50:899] nserror: nsres: id=0, op=65, ns=12542,ns2=12560; nt[0]=512, nt[1]=48,
nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
(3752) [10-JUN-2004 15:20:50:899] nsopen: unable to open transport
(3752) [10-JUN-2004 15:20:50:899] nioqper: error from nscall
(3752) [10-JUN-2004 15:20:50:899] nioqper: nr err code: 0
(3752) [10-JUN-2004 15:20:50:899] nioqper: ns main err code: 12542
(3752) [10-JUN-2004 15:20:50:899] nioqper: ns (2) err code: 12560
(3752) [10-JUN-2004 15:20:50:899] nioqper: nt main err code: 512
(3752) [10-JUN-2004 15:20:50:899] nioqper: nt (2) err code: 48
(3752) [10-JUN-2004 15:20:50:899] nioqper: nt OS err code: 0
(3752) [10-JUN-2004 15:20:50:899] niqme: reporting NS-12542 error as ORA-12542
(3752) [10-JUN-2004 15:20:50:899] niomapnserror: returning error 12542
(3752) [10-JUN-2004 15:20:50:899] niotns: Couldn't connect, returning 12542
(432) [10-JUN-2004 15:20:50:899] nstimarmed: no timer allocated
SQLNET.LOG file:
=============
Fatal NI connect error 12542, connecting to:
(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS=(PROTOCOL=TCP)(HOST=tst81)(PORT=1526))(CONNECT_DATA=(SID=sec)
(SRVR=DEDICATED)(CID=(PROGRAM=c:\windows\system32\inetsrv\w
3wp.exe)(HOST=SRVPDFTEST)(USER=userarchive))))
VERSION INFORMATION:
2016/11/22 文檔顯示
https://support.oracle.com/epmos/faces/SearchDocDisplay?_adf.ctrlstate=
eur163egx_9#SYMPTOM 2/3
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
Windows NT TCP/IP NT Protocol Adapter for 32-bit Windows: Version 9.2.0.1.0 - Production
Time: 10-JUN-2004 15:20:50
Tracing to file: E:\oracle\ora92\temp\cli_1732.trc
Tns error struct:
nr err code: 0
ns main err code: 12542
TNS-12542: TNS:address already in use
ns secondary err code: 12560
nt main err code: 512
TNS-00512: Address already in use
nt secondary err code: 48
nt OS err code: 0
CAUSE
The problem is due to the fact that the free TCP ports on the Windows client have been exhausted and it is
trying to make use of a port which is in TIME_WAIT state and which throws the error:
TNS-12542: Address already in use
SOLUTION
There are 3 possible solutions:
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)
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.
Note that any change to TCPIP parameters in the Windows registry would requires a restart of the server.
3.) Use of IPC protocol
==================
2016/11/22 文檔顯示
https://support.oracle.com/epmos/faces/SearchDocDisplay?_adf.ctrlstate=
eur163egx_9#SYMPTOM 3/3
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.
REFERENCES
NOTE:29232.1 - IPC Explained
關于tcpip連接的文章轉載如下:
怎么解決在window下高并發TCP請求端口被占用有關問題
網友分享于:2015-08-26??瀏覽:273次
如何解決在window下高并發TCP請求端口被占用問題
當客戶端啟動到服務器的 TCP/IP 套接字連接時,客戶端通常連接到服務器上的特定端口,并請求服務器通過臨時(或暫時)TCP 或 UDP 端口進行響應。在 Windows Server 2003 和 Windows XP 中,客戶端應用程序所使用的臨時端口的默認范圍為 1025 到 5000。在某些情況下,有可能耗盡默認范圍的可用端口。
TCP/IP 端口耗盡會導致連接到 BizTalk Server 的應用程序及連接到遠程服務器的 BizTalk 應用程序出現意外錯誤
TCP/IP 端口耗盡的癥狀隨客戶端應用程序的不同而不同,但通常都表現為顯示網絡連接失敗錯誤。若要確定網絡連接失敗是否是由 TCP/IP 端口耗盡造成的,請在客戶端計算機上執行以下步驟:
在運行 Windows XP 或 Windows Server 2003 的計算機上單擊“開始”,再單擊“運行”,然后鍵入?cmd,單擊“確定”打開命令提示。
執行以下操作之一:
在 Windows XP 或 Windows Server 2003 計算機上的命令提示中輸入以下命令,顯示此計算機上 TCP/IP 協議所使用的活動連接:
復制
netstat -n 這將列出綁定到客戶端計算機的 TCP/IP 地址以及 TCP/IP 地址與遠程服務器通信所使用的端口。如果列出的端口使用了所有可用的端口,則出現了 TCP/IP 端口耗盡現象。
在基于 Windows Server 2003 的客戶端計算機的命令提示中輸入以下命令,以顯示 TCP/IP 協議所使用的活動連接:
復制
netstat -b 這將列出綁定到客戶端計算機的 TCP/IP 地址、TCP/IP 地址與遠程服務器通信所使用的端口以及使用這些端口的應用程序。此信息可以幫助您確定那個客戶端應用程序正在使用過多的 TCP/IP 端口。
與 TCP/IP 端口耗盡有關的問題
當客戶端應用程序嘗試使用 TCP/IP 套接字連接到 BizTalk Server,或當 BizTalk 應用程序嘗試使用 TCP/IP 套接字連接到服務器時,可能會出現類似于下面的情況:
復制
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.
- 或者 -
復制
Unable to connect to the remote server
System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted.
當出現這些錯誤時,還可能出現以下問題:
客戶端應用程序可能無法連接到 BizTalk Server。
BizTalk 應用程序服務可能無法連接到遠程 SQL 服務器。
BizTalk Server 適配器可能無法連接到遠程服務器。
客戶端應用程序預留的每個端口均占用內核內存。如果預留了數目超常的客戶端端口,Windows 內核內存的占用率將相應增加。
原因
如果客戶端計算機中存在數目超常的 TCIP/IP 套接字連接,則客戶端計算機上可能出現 TCP/IP 端口耗盡的情況。如果多個客戶端應用程序都在建立連接,則可能出現這種情況。
如果所有可用的臨時端口都分配給了客戶端應用程序,則客戶端將出現 TCP/IP 端口耗盡的情況。當 TCP/IP 端口耗盡時,將無法預留客戶端端口,并且嘗試通過 TCP/IP 套接字連接到服務器的客戶端應用程序也將出錯。
在高負載情況下,比處于正常負載時更容易出現 TCP/IP 端口耗盡的情況。
解決方法
執行以下步驟以避免 TCP/IP 端口耗盡及其相關問題:
驗證客戶端應用程序沒有生成過多的 TCP/IP 套接字連接。這一點可以用上面提到的方法來檢查,即在 Windows Server 2003 和 Windows XP 上運行?netstat -n,或者在 Windows Server 2003 和 2008 上運行?netstat -b。
如果某個客戶端應用程序使用了數量超常的 TCP/IP 套接字連接,則應考慮重新設計客戶端應用程序,以便更有效地使用 TCP/IP 套接字連接。
注意
如果為 BizTalk 應用程序服務 (BTSNTSvc.exe) 實例預留了數量超常的客戶端端口,則需驗證配置為在 BizTalk 應用程序服務中運行的任何自定義代碼都沒有建立過多的 TCP/IP 套接字連接。
如果大量客戶端應用程序要啟動已知數量的 TCP/IP 套接字連接,但沒有足夠數量的可用臨時端口來滿足連接請求,則需要進行以下注冊表修改。
警告
如果注冊表編輯器使用不當,則可能會產生嚴重問題,導致重新安裝操作系統。Microsoft 不保證可以解決因注冊表編輯器使用不當而造成的問題。請慎用注冊表編輯器,風險自負。在修改注冊表之前,請務必備份注冊表,并確保您知道在發生問題時如何使用備份進行還原。有關如何備份、還原及修改注冊表的詳細信息,請參閱 Microsoft 知識庫文章“Microsoft Windows 注冊表說明”,網址為?http://go.microsoft.com/fwlink/?LinkId=62729。 增加動態分配到客戶端 TCP/IP 套接字連接的臨時端口的上限。
啟動注冊表編輯器。
在注冊表中,瀏覽到并單擊以下注冊表項。
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
在“編輯”菜單中單擊“新建”、“DWORD 值”,然后添加以下注冊表值,以增加可以動態分配到客戶端的臨時端口的數量:
值名稱
MaxUserPort
值數據
關閉注冊表編輯器。
注意
必須重新啟動計算機,此更改才會生效。
注意
增加用于客戶端 TCP/IP 連接的臨時端口的范圍將占用 Windows 內核內存。請勿將此設置的值增加至超過容納客戶端應用程序套接字連接所需要的值,以便盡可能降低對 Windows 內核內存的不必要占用。降低客戶端 TCP/IP 套接字連接的超時值(默認值為 240 秒)
啟動注冊表編輯器。
在注冊表中,瀏覽到并單擊以下注冊表項。
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
在“編輯”菜單中單擊“新建”、“DWORD 值”,然后添加以下注冊表值,以縮短關閉連接時,該連接處于 TIME_WAIT 狀態的時間。當連接處于 TIME_WAIT 狀態時,套接字對無法重新使用:
值名稱
TcpTimedWaitDelay
值數據
關閉注冊表編輯器。
注意
必須重新啟動計算機,此更改才會生效。
注意
此值的有效范圍為 30 到 300(十進制)之間。默認值為 240。
進行了修改,問題得到解決
總結
以上是生活随笔為你收集整理的oracle地址已被占用,ORA-12542 TNS 地址已被占用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java annotation应用_ja
- 下一篇: JAVA输出x和y和z_JAVA实例:输