Skip to Main Content
  • Questions
  • Exception when executing Bulk Collect

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question.

Asked: March 15, 2018 - 11:05 am UTC

Last updated: August 18, 2018 - 1:08 pm UTC

Version: 12.1.0.2

Viewed 1000+ times

You Asked

I am using bulk collect with save exceptions, it runs fine sometimes and sometimes it errors out.

The error is as follows -

BEGIN
*
ERROR at line 1:
ORA-00028: your session has been killed
ORA-00028: your session has been killed
ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT
ORA-00001: unique constraint (<<Schema name>>.<<Target table COnstraint>>) violated
ORA-06512: at "<<Procedure name>.", line 181
ORA-06512: at line 2


My question is -

I still need to debug the PGA issue, I am using LIMIT 100 .. it gives the same error with LIMIT 1 also.

Why is it giving me a "ORA-00001: unique constraint (<<Schema name>>.<<Target table Constraint>>) violated" when I am using save exception.

If you want the code I can share the same but that may not be possible on an open site. Please help!!


Thanks!!

and Chris said...

The real problem is here:

ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT


You're blowing out your PGA limit. Either you PGA_AGGREGATE_LIMIT is waaaaay to too low. Or you've got something else chewing up memory.

You can find what's consuming PGA with the following query:

select pga_used_mem, pga_alloc_mem , s.*
from   v$process p
join   v$session s
on     p.addr = s.paddr
order  by 1 desc;

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

ORA 4036 while creating Index

A reader, August 16, 2018 - 1:12 pm UTC

Hi,

I am trying to create an index on a big table. The table has almost billion rows. Now my index creation fails with -

Oracle Error: ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT

There is nothing else except the index creation in progress. I may have to drill down further but my question is -

Can creation of an (B+ Tree) index in oracle lead to a PGA overflow?

Regards!!
Connor McDonald
August 18, 2018 - 1:08 pm UTC

Yeah, typically you should not be getting that - pga_agg_limit is designed to make sure that you don't smoke the entire server (assuming its been set sensibly).

But sorting operations (such as create index) should respect that and dump to temporary storage accordingly.

It is possible to disable the check by setting the limit to zero (which means we wont keep an eye on what we're doing to your server!), but I'd log a call with Support before heading down that path

Thanks!!

A reader, August 20, 2018 - 4:15 pm UTC

Thanks Chris!! This confirms what I thought :)

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library