ORA-04036: PGA memory used by the instance exceeds PGA AGGREGATE LIMIT
PGA_AGGREGATE_LIMIT is used from Oracle 9i with automatic management of the PGA. It specify as SOFT LIMIT in Oracle 9i but from Oracle 12c it becomes the HARD LIMIT. In Oracle 9i it provide more memory if needed but it will get error in Oracle 12c if limit exceeds.
Error
ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT
Default Setting
Default setting of PGA in Oracle 12c
Connected.
SQL> show parameter pga
NAME TYPE VALUE ---------------------- ----------- ------------------------------ pga_aggregate_limit big integer 2G pga_aggregate_target big integer 512M
Solution
If you face the error ORA-04036 then you will increase the value of PGA_AGGREGATE_LIMIT parameter. It is dynamic parameter you can increase the value.
But you cannot decrease the value below the PGA_AGGREGATE_TARGET.
--Check PGA parameter value
SQL> show parameter pga
NAME TYPE VALUE ---------------------- ----------- ------------------------------ pga_aggregate_limit big integer 2G pga_aggregate_target big integer 512M
-- Increase the value to 6G
ALTER SYSTEM SET PGA_AGGREGATE_LIMIT=6G SCOPE=BOTH;
Disable parameter for getting rid of error ORA-04036
Note: You can use old behavior as used in Oracle 9i by disable it to set the value ZERO with SOFT LIMIT. It will disable the error permanently.
ALTER SYSTEM SET pga_aggregate_limit=0 SCOPE=BOTH;
You can try another solution, For Stop or reduce the PGA Memory usage, you can disable the parameter instead of using upper provided solution and monitor the your database error or its performance also.
SQL> alter system set "_optimizer_adaptive_cursor_sharing" = FALSE scope=both;
SQL> alter system set "_optimizer_use_feedback" = FALSE scope=both;
SQL> alter system set "_optimizer_gather_feedback" = FALSE scope=both;