ORA-04030: out of process memory when trying to allocate N bytes
OracleWhat does it mean?
A server process could not allocate space in its PGA (Program Global Area), i.e. its private process memory. Unlike shared memory in the SGA, this is the exhaustion of a single session's/process's own memory.
Why does it happen?
Very large sort/hash operations, oversized PL/SQL collections, variables accumulating in uncontrolled loops, or operating system process memory limits (ulimit -v/-d, vm.max_map_count, address space) have exhausted process memory. On 32-bit instances the address space limit can also trigger it.
How to fix it
Find what is consuming memory by examining the allocation category on the second line of the error (e.g. 'pga heap', 'koh-kghu sessi'). Review PGA_AGGREGATE_LIMIT / PGA_AGGREGATE_TARGET. Check operating system limits (ulimit -a; memlock, as, stack for the oracle user). Optimize the query/PL/SQL and reduce bulk processing batch sizes. If needed, contact Oracle Support with the trace file.