ORA-4036 PGA memory used by the instance exceeds

In Oracle 12c introduced new parameter PGA_AGGREGATE_LIMIT to allow database administrators to limit the aggregate PGA (Program Global Area) memory usage.
By setting the above parameter you will enable a hard limit on PGA usage. If the pga_aggregate_limit value is exceeded, Oracle database will aborts or terminates the sessions or processes that are consuming the most untunable PGA memory.

In Oracle release 18c and above, The MGA (Managed Global Area) is accounted for out of the PGA.
What this means in practical terms is that the PGA size must be increased in 18c and above versions to accommodate the MGA.
The PGA memory allocation which has required the pga_aggregate_limit to be large enough to handle the MGA also.

Connected processes will not free up space allocated to them back to the Operating System until they are disconnected. This is an expected behavior.

To avoid the ORA-04036 error and termination of processes:

  1. Set the PGA_AGGREGATE_LIMIT = 0

Setting the value to 0 meaning is that UNLIMITED as it was in 11g versions where we do not control the growth of PGA.

SQL> alter system set pga_aggregate_limit=0 scope=both sid=’*’;

OR

  1. Increase the PGA_AGGREGATE_LIMIT initialization parameter

SQL> alter system set PGA_AGGREGATE_LIMIT = scope=both sid=’*’;

The rule of thumb for the pga_aggregate_limit is:

PGA_AGGREGATE_LIMIT =(original PGA_AGGREGATE_LIMIT value) + ((maximum number of connected processes) * 4M)

You can refer the following documents for more details on PGA_AGGREGATE_LIMIT:

Limiting Process Size with Database Parameter PGA_AGGREGATE_LIMIT NOTE:1520324.1
Sizing the PGA in Oracle 19c – How to Account for the MGA Size NOTE:2808761.1 – shows a more scientific method of calculating the PGA in 19c.
MGA (Managed Global Area) Reference Note NOTE:2638904.1



Yorum bırakın