SYMPTOMS ORA-04031 Errors Occurring
ORA-04031 errors occurring in a RAC instance with the trace file showing high memory usage for "ges resource dynamic" and "ges enqueues" memory in the shared pool. This can cause LMD processes to become unresponsive leading to an instance termination.
The following query can be used to determine if this fix will help:
select substr(RESOURCE_NAME,instr(RESOURCE_NAME,'[',1,3)+1,2) , MASTER_NODE, count(*) from gv$ges_resource where substr(RESOURCE_NAME,instr(RESOURCE_NAME,'[',1,3)+1,2) in ('DX', 'BB') group by substr(RESOURCE_NAME,instr(RESOURCE_NAME,'[',1,3)+1,2), MASTER_NODE order by 3 desc;
If that shows a large number of entries (much larger than the expected total number of transactions), then this fix will help.
CAUSE for ORA-04031
This is due to unpublished bug:21373473 fixed in 12.2, and occurs due to DX and BB locks being cached but not cleared out. This fix removes the need to cache DX and BB locks and hence reduces overall shared pool memory usage in RAC instances.
ORA-04031 errors occurring with high memory utilization for "ges enqueues" & "ges resource dynamic" memory allocations.
Download and apply the one-off patch number 21373473 (Patch:21373473) for your platform and version combination. Please note that if using 18.104.22.168, then you should also apply the related patch number 21260431 (Patch:21260431) which also impacts the shared pool memory allocations identified here.
This issue can also be worked around by setting _GES_DIRECT_FREE_RES_TYPE="CTARAHDXBB" in the instances.
Note:- We also found ORA-01041: internal error. hostdef extension doesn't exist in alert logs that depends on ORA-04031. also suggest to open a Service request with oracle if not sure with above method.