Thursday, January 31, 2008

Orastack

The orastack utility is a tool provided by oracle to set the stack size reserved or commited on a per thread basis in the Oracle Server on Windows Operating Systems. I had to use it because on a 10gR2 Winx32 database frequent ORA-04030 errors displayed along with TNS-12518.

The database must be shutdown prior to issue the command, otherwise this error will show up:

C:\Oracle\product\10.2.0\db_1\BIN>orastack oracle.exe 524288
Couldn't open file with CreateFile()
GetLastError() == 32

The default value is 1024K, it can be reduced to 512K, but it is not recommended to reduce the value below 300K, otherwise the ORA-01331 may start to show up.

Syntax:
  • orastack {no arguments} will display a useful README 1st.
  • orastack executableName will display the current settings
  • orastack executableName newValue will reset the current value to the specified newValue

2 comments:

Santosh Kumar said...

Hi Madrid,

What are the trade-offs of reducing the default size 1024k to 512k (for oracle.exe or tnslsnr.exe).
Do we expect any performance degradation after the change?

Regards,
Santosh Kumar

Hector R. Madrid said...

There are no performance related issues if you change the value of the stack size.
Oracle provides the orastack.exe tool to customize the amount of stack memory reserved per thread/session. when this tool is run it modifies the executable header that defines the amount of memory this process will reserve for the stack memory.
The trade off of increasing vs. reducing the amount of reserved stack memory has to do with the number of concurrent sessions given a memory constrained sytem:

If a large stack has been defined then the memory requirements will be higher, thus allowing less concurrent sessions before the ORA-04030 oracle error shows up.

If the stack is reduced then there will be more room for concurrent sessions, but if this value is very small, processes may risk facing the ORA-03113 (end-of-file on communication channel) error without leaving a trace behind.

Applications must be tested before implementing in a production environment. In case of doubt you must ask Oracle Support Services.