Sentinel: ORA-04031: unable to allocate … shared memory

  • 3099331
  • 06-Dec-2006
  • 26-Apr-2012

Environment

RedHat Linux
Solaris 9
Sentinel 5.1.x

Situation

Why am I getting an Oracle error, "Caused by ORA-04031: unable to allocate 4096 bytes of shared memory"?

---------------------------------------------------------------------------------

Tue Dec 13 15:16:31 MST 2005|Thread-2985|INFO|Total 11 filters and combined cardinality of 66, total 20,484 allocated buckets with a combined total of 25,140
values and 1,325 events.||||esecurity.ccs.comp.rtevent.summary.SummaryServiceImpl|reportStatistics|
Tue Dec 13 15:16:33 MST 2005|Thread-101|SEVERE|; Exception Error saving events; java.lang.RuntimeException; ; Caused by ORA-04031: unable to allocate 4096 byt
es of shared memory ("shared pool","EVENTS_IX1","pacdHds_kkpaco","stP_kkpacd: kkpodPacdInit")
ORA-06512: at "ESECDBA.ESEC_INSERT_EVENTS", line 209
ORA-06512: at line 1
; java.sql.BatchUpdateException; ||||esecurity.base.ccs.comp.BaseTask|run|
Tue Dec 13 15:16:33 MST 2005|Thread-101|SEVERE|java.lang.RuntimeException: Error saving events
at esecurity.ccs.comp.event.jdbc.JDBCEventStore.procAddEvents(JDBCEventStore.java:304)
at esecurity.ccs.comp.event.jdbc.JDBCEventStore.store(JDBCEventStore.java:198)
at esecurity.ccs.comp.event.EventStoreTask.doProcess(EventStoreTask.java:99)
at esecurity.ccs.comp.event.EventStoreTask.process(EventStoreTask.java:46)
at esecurity.base.ccs.comp.BaseTask.run(BaseTask.java:52)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.BatchUpdateException: ORA-04031: unable to allocate 4096 bytes of shared memory ("shared pool","EVENTS_IX1","pacdHds_kkpaco","stP_kkpacd:
kkpodPacdInit")
ORA-06512: at "ESECDBA.ESEC_INSERT_EVENTS", line 209
ORA-06512: at line 1

at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:4337)
at esecurity.ccs.comp.event.jdbc.JDBCEventStore.procAddEvents(JDBCEventStore.java:290)
... 6 more
||||esecurity.base.ccs.comp.BaseTask|run|
Tue Dec 13 15:16:34 MST 2005|Thread-13|INFO|EventStore received 10 messages with 82 events, currently 0 waiting, 0 running, JVM Size 163MB||||esecurity.ccs.co
mp.event.EventStoreService|batchFault|
Tue Dec 13 15:16:35 MST 2005|Thread-2885|INFO|Keeping permanent requestor Attribute: sev Filter: (( EVENTS.SEV >= ? ) AND ( EVENTS.VULN = ? ))[ 1: '0',
2: '1']||||esecurity.ccs.comp.rtevent.summary.SummaryServiceImpl$RequestorReporterManager|removeStaleRequestors|
Tue Dec 13 15:16:35 MST 2005|Thread-2885|INFO|Keeping permanent requestor Attribute: sev Filter: (( EVENTS.SEV >= ? ) AND ( port = ? ))[ 1: '0', 2: t>'Sourcefire']||||esecurity.ccs.comp.rtevent.summary.SummaryServiceImpl$RequestorReporterManager|removeStaleRequestors|
Tue Dec 13 15:16:35 MST 2005|Thread-2885|INFO|Keeping permanent requestor Attribute: sev Filter: (( EVENTS.SEV >= ? ) AND ( port = ? ))[ 1: '0', 2: t>'SYSLOG_MQ_UNIX']||||esecurity.ccs.comp.rtevent.summary.SummaryServiceImpl$RequestorReporterManager|removeStaleRequestors|
Tue Dec 13 15:16:36 MST 2005|Thread-102|SEVERE|; Exception Error saving events; java.lang.RuntimeException; ; Caused by ORA-04031: unable to allocate 3920 byt
es of shared memory ("shared pool","CORRELATED_EVENTS_UK1","pacdHds_kkpaco","phP_kkpacd: kkpodPacdInit")
ORA-06512: at "ESECDBA.ESEC_INSERT_CORRELATED_EVENTS", line 13
ORA-06512: at line 1
; java.sql.BatchUpdateException; ||||esecurity.base.ccs.comp.BaseTask|run|
Tue Dec 13 15:16:36 MST 2005|Thread-102|SEVERE|java.lang.RuntimeException: Error saving events
at esecurity.ccs.comp.event.jdbc.JDBCEventStore.procAddEvents(JDBCEventStore.java:304)
at esecurity.ccs.comp.event.jdbc.JDBCEventStore.store(JDBCEventStore.java:198)
at esecurity.ccs.comp.event.EventStoreTask.doProcess(EventStoreTask.java:99)
at esecurity.ccs.comp.event.EventStoreTask.process(EventStoreTask.java:46)
at esecurity.base.ccs.comp.BaseTask.run(BaseTask.java:52)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.BatchUpdateException: ORA-04031: unable to allocate 3920 bytes of shared memory ("shared pool","CORRELATED_EVENTS_UK1","pacdHds_kkpaco","p
hP_kkpacd: kkpodPacdInit")
ORA-06512: at "ESECDBA.ESEC_INSERT_CORRELATED_EVENTS", line 13
ORA-06512: at line 1

at oracle.jdbc.dbaccess.DBError.throwBatchUpdateException(DBError.java:459)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:4337)
at esecurity.ccs.comp.event.jdbc.JDBCEventStore.procAddEvents(JDBCEventStore.java:290)
... 6 more
||||esecurity.base.ccs.comp.BaseTask|run|

Resolution

This error indicates that you are running out of shared memory. To fix this you need to increase the SHARED_POOL_SIZE. This can be done by editing the file initesec.ora.

ORA-04031: unable to allocate … shared memory


Symptom:

The Oracle error:

ORA-04031: unable to allocate nnn bytes of shared memory

Cause:

More shared memory is needed than was allocated. SGA private memory has been exhausted.

Fragmentation of shared pool memory is a common problem and ORA-04031 is commonly a result of such fragmentation. Application programmers usually get this error while attempting to load a big package or while executing a very large procedure and there is not sufficient contiguous free memory available in the shared pool. This may be due to fragmentation of the shared pool memory or insufficient memory in the shared pool.

Possible remedies:

  • Use the dbms_shared_pool package to pin large packages.

  • Attempt to reduce the use of shared memory.

  • Increase the initialisation parameter ‘SHARED_POOL_SIZE’.


Alternate symptom

An error of the form (Oracle 8.1.5):

ORA-04031: unable to allocate NNNNN bytes of shared memory ("large pool","unknown object","large pool hea","PX msg pool")

Cause:

This error indicates that Oracle is unable to allocate memory from the ‘large’ pool.

To determine the number of free bytes in the ‘large’ pool execute the following SQL:

SELECT NAME, SUM(BYTES) FROM V$SGASTAT WHERE POOL='LARGE POOL' GROUP BY ROLLUP (NAME);

Possible Remedy:

  • To resolve the problem, consider increasing the value for ‘LARGE_POOL_SIZE’.