配置256g內存的機器,監聽時連得上時連不上,然后查看監聽日志,報
TNS-12531: TNS:cannot allocate memory,也不是次次都報,重復連個幾次,就這樣了;
查下MOS說明:
![]() | Windows: Oracle Net or Connections Via the Listener Fail with TNS-12531 On Windows 64-bit Platform (文檔 ID 1384337.1) |
This can be caused by an inadequate setting for?Desktop Heap Size. Even if this is a 64-bit OS with high amount of memory, there is still a limitation that generates this error.
Of course, it can also be caused when the memory is actually low.? Check the resource consumption at the time of this problem.? If there is no apparent memory shortage,?
the solution documented here may resolve the issue.
Check and edit the Desktop Heap size located here in the registry:
Launch regedt32 and go to:
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems\
In the right pane, click on?Windows?and pull down Edit then select Modify.
You should see a string that resembles this in its entirety:
%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=1024,20480,768?Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=winsrv:ConServerDllInitialization,2 ServerDll=sx***v,4 ProfileControl=Off MaxRequestThreads=16
Focus on this section:
Windows SharedSection=1024,20480,768
The third argument is the maximum amount of heap memory allocated to non interactive desktops.?
Increase this third value and check when the TNS error disappears. There is no optimum value.?It
varies on each MS Windows server.
說明一下:
第三個 SharedSection 值 (512) 是為"非交互式"窗口站與相關聯的每個桌面桌面堆的大小。如果不存在此值為非交互式窗口站桌面堆的大小將與為交互式窗口站 (第二個 SharedSection 值) 指定的大小相同。
檢查了一下這個值,為2048已經調大,如果加大,確實能緩解這個問題,但此時連接的會話并不多,才73個,那么問題明顯不在這;是誰把這非交互式堆棧耗完了呢,看下了進程數,全為conhost&cmd.exe進程,也就是這玩意用完了;
簡單暴力點,直接:taskkill /im:conhost.exe /f,沒有再報錯了;
官方也明確說了,這是個BUG
Bug 14324057 - Windows: "%%i was unexpected at this time" when cluvfy executes (文檔 ID 14324057.8) |
在11.2.0.3.10中修復;
驗證方法:
C:\Users\oradba>%ORACLE_HOME%\bin\cluvfy?comp?nodecon?-n?all
臨時解決辦法是殺了就好了,如果做進程分析,可以考慮用windbg做下,
首先導入SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
open一個dmp文件,
windbg常用命令:
命令 | 說明 |
.loadby sos clr? | 加載調試擴展(.NET4.0以下使用mscorwks) |
!threadpool or !tp | 顯示有關托管線程池的信息 |
~* e!clrstack | 顯示所有線程的堆棧 |
~* e!pe | 顯示發生在所有線程上的最后的異常 |
!runaway | 顯示線程耗費的CPU時間 |
!syncblk | 查看程序阻塞 |
.logopen | 記錄調試日志 |
vertarget | 查看系統運行時間 |
!peb | 查看完整的進程啟動的命令行參數,加載的DLL及環境變量等 |
!dml_proc | 查看進程Id及進程全路徑名稱 |
.cls | 清屏 |
q | 退出當前調試 |
!analyze -v | 詳細顯示當前異常信息 |
~0s | 切換到指定線程(中間的數字表示線程號) |
!clrstack | 查看線程的調用堆棧,僅提供托管代碼的堆棧跟蹤 ?參數?-p ?顯示托管方法的參數值 |
!printexception 或 !pe | 顯示當前活動線程上的最后一個異常 |
!dumpstackobjects 或 !dso | 顯示在當前堆棧的邊界內找到的所有托管對象 |
!dumpobj <address>或者 !do | 顯示對象信息,指定任何有效的對象地址,就能查看該對象的內容 |
!dumparray <address>或者!da | 顯示數組信息 |
!gcroot -nostacks <address>??? | 顯示對象內存引用;-nostacks 選項將搜索限制為垃圾回收器句柄和 Freachable對象 |
!dumpheap –stat | 查看堆中的所有對象信息,包括類型信息,個數,大小等 |
!dumpheap -mt <MT Adress> ? [-min ] | 查看指定類型的對象及大小,可以指定最小、大值 |
!eeheap -gc | -loader | 查看托管對象和程序結構在內存中占用情況 |
!address -summary | 查看進程的內存分布情況,包括非托管內存 |
.foreach (myobj{!dumpheap -mt 008f4104-short}) {!do ${myobj}} | 輸出多個對象信息,該命令會對于堆中所有類型為008f4104的對象,依次調用!do命令 |
下載WinDGG:http://msdn.microsoft.com/en-us/windows/hardware/hh852365
64bit:http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/setup/WinSDKDebuggingTools_amd64/dbg_amd64.msi
32bit:http://download.microsoft.com/download/A/6/A/A6AC035D-DA3F-4F0C-ADA4-37C8E5D34E3D/setup/WinSDKDebuggingTools/dbg_x86.msi
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。