ORA-4031: Unable to allocate bytes of shared memory
FranklinFaces.com
FranklinFaces.com - Oracle & SQL Server Database Forums for all IT Professionals
 Home          Members     Calendar     Who's On

Welcome Guest ( Login | Register )
        



ORA-4031: Unable to allocate bytes of shared... Expand / Collapse
Message
Posted 6/14/2010 3:24:34 PM Post #330
 

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being
ORA-4031: Unable to allocate bytes of shared memory

ORA-4031 is a very common error that many dba's face in their day to day activities. This error can commonly occur due to the SHARED POOL SIZE. This error can be due to an inadquate sizing of the SHARED POOL or due to  fragmentation of the shared pool. 

Oracle Shared Pool Memory Inadequate Sizing: The first thing is determining if the ORA-04031 error is a result of lack of contiguous space in the library cache. This can be veriried by validating the following from V$SHARED_POOL_RESERVED

1. REQUEST_FAILURES >0 and LAST_FAILURE_SIZE < SHARED_POOL_RESERVED_MIN_ALLOC

2. REQUEST_FAILURES=0 and LAST_FAILURE_SIZE is < SHARED_POOL_RESERVED_MIN_ALLOC

If the above cases are true, consider allowing the database to put more objects in shared pool reserved space by lowering SHARED_POOL_RESERVED_MIN_ALLOC. If the problem is still not resolved, consider increasing the SHARED_POOL_SIZE

Oracle Shared Pool Memory Fragmentation: The issue can be attributed to fragmentation if REQUEST_FAILURES is > 0 and LAST_FAILURE_SIZE is > SHARED_POOL_RESERVED_MIN_ALLOC.

To resolve this issue, you should increase the SHARED_POOL_RESERVED_MIN_ALLOC to reduce the number of objects being cached into the shared pool reserved space. Also increase the SHARED_POOL_RESERVED_SIZE and SHARED_POOL_SIZE to incrase the available memory in the shared pool reserved space. It is recommended that the reserved space be sized to be 10% of the total shared pool area.

Posted 6/14/2010 3:27:44 PM Post #331
 

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being
04031, 00000, "unable to allocate %s bytes of shared memory (\"%s\",\"%s\",\"%s\,\"%s\")"
// *Cause:  More shared memory is needed than was allocated in the shared pool.
// *Action: If the shared pool is out of memory, either use the
//          dbms_shared_pool package to pin large packages,
//          reduce your use of shared memory, or increase the amount of
//          available shared memory by increasing the value of the
//          INIT.ORA parameters "shared_pool_reserved_size" and
//          "shared_pool_size".
//          If the large pool is out of memory, increase the INIT.ORA
//          parameter "large_pool_size".

ORA-4031 error is encountered when we do not have sufficient memory available in shared pool/large pool to service a memory request. But in actual ORA – 4031 can be encountered in any of these areas

1) Shared pool
2) Large Pool
3) Java Pool
4)Streams pool (new to 10g)

Common Causes/Solutions

>>>>

The ORA-4031 can occur for many different reasons.  Some possible causes are:

  • SGA components too small for workload
  • Auto-tuning issues
  • Fragmentation due to application design
  • Bug/leaks in memory allocations
For more on the 4031 and how this affects the SGA, see 
Note 396940.1 Troubleshooting and Diagnosing ORA-4031 Error>>
>
Because of the multiple potential causes, it is important to gather enough diagnostics so that 
an appropriate solution can be identified.  However, most commonly the cause is associated 
with configuration tuning.   Ensuring that MEMORY_TARGET or SGA_TARGET are large 
enough to accommodate workload can get around many scenarios. 
 
The default trace associated with the error provides very high level information about the 
memory problem and the "victim" that ran into the issue.   The data in the default trace is 
not going to point to the root cause of the problem.
 
When migrating from 9i to 10g and higher, it is necessary to increase the size of the Shared 
Pool due to changes in the basic design of the shared memory area.
 
Note 270935.1 Shared pool sizing in 10g

NOTE: Diagnostics on the errors should be investigated as close to the time of the error(s)
as possible.  If you must restart a database, it is not feasible to diagnose the problem 
until the database has matured and/or started seeing the problems again.
 
Note 801787.1 Common Cause for ORA-4031 in 10gR2, Excess "KGH: NO ACCESS" 
Memory Allocation>>
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: silencer

Permissions Expand / Collapse

All times are GMT -5:00, Time now is 9:06am

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0.070. 9 queries. Compression Disabled.
Contextual Links