I am seeing trace files for ORA-04031 being created in user_dump_dest, although for some reason there are no corresponding entries in alert.log.
The instance has 7 sub-pools (shared_pool_size = 5 GB), this could be seen from the trace files and from x$ksmss (script sgastatx from Tanel Poder).
When ORA-04031 gets reported in alert.log it clearly shows the sub-pool, for example:
ORA-04031: unable to allocate 4216 bytes of shared memory ("shared pool","unknown object","sga heap(6,0)","library cache")
Here the error occurred in the sub-pool number 6.
Question: how to determine sub-pool from ORA-04031 trace files?
Dump file /ora/oracle/admin/XXXXX/udump/xxxxx_ora_20241.trc
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
JServer Release 9.2.0.8.0 - Production
ORACLE_HOME = /xxx
System name: SunOS
Node name: xxxxx
Release: 5.10
Version: Generic_147440-01
Machine: sun4u
Instance name: XXXXX
Redo thread mounted by this instance: 1
Oracle process number: 615
Unix process pid: 20241, image: oracle@xxxxxxxxxx (TNS V1-V3)
*** 2015-06-22 11:07:03.220
*** SESSION ID:(318.22706) 2015-06-22 11:07:03.200
=================================
Begin 4031 Diagnostic Information
=================================
The following information assists Oracle in diagnosing
causes of ORA-4031 errors. This trace may be disabled
by setting the init.ora parameter _4031_dump_bitvec = 0
======================================
Allocation Request Summary Information
======================================
Current information setting: 00654fff
Dump Interval=300 seconds SGA Heap Dump Interval=3600 seconds
Last Dump Time=06/22/2015 11:07:03
Allocation request for: audit policy chain
Heap: 1081d450c0, size: 4216
******************************************************
HEAP DUMP heap name="sga heap" desc=380000030
extent sz=0xfe0 alt=200 het=32767 rec=9 flg=-126 opc=0
parent=0 owner=0 nex=0 xsz=0x0
******************************************************
HEAP DUMP heap name="library cache" desc=1081d450c0
extent sz=0x358 alt=32767 het=32 rec=0 flg=2 opc=2
parent=380000030 owner=1122e0d328 nex=0 xsz=0x1
Subheap has 9896 bytes of memory allocated