问题一、
针对该次shared pool的问题进行的记录。
故障描述:
XXX集团2024-05-09前经常受到ORA-04031报错困扰,一直报的是shared pool,所以客户自己将shared pool手动配置了20g,还是报错,再配40g,还是报错,找我司来进行排查。
故障分析:
1.当前故障的情况,分析内存的消耗组成
分析sga的使用组成(sga中 shared pool过高,一般1/2即可。)
select component,current_size,min_size,max_size from v$sga_dynamic_components order by 2;
分析shared pool的组成
select pool,name,bytes/1024/1024 M from v$sgastat where pool='shared pool' order by M;
发现 SQLA和KGLH0过高,确认方向。
2.历史故障的情况,分析trc日志(例orcl_ora_6084.trc)
发现7个sub pool都是SQLA和KGLH0过高,加起来占6成左右。
发现 SQLA和KGLH0过高,确认方向。
trc文件:
<<orcl_ora_6084.trc>>
处理方法:
一、根据mos Doc ID 2096561.1
在不同版本为不同bug.
>=12.2
删除pdb级SHARED_POOL_SIZE和/或SGA_MIN_SIZE初始化参数。
Oracle建议在PDB级别设置的唯一SGA内存大小参数是SGA_TARGET。
12.1<=x<12.2
alter system set "_optimizer_use_feedback"=false scope=both;
alter system set "_optimizer_gather_feedback"=false scope=both;
并重启实例(虽然参数生效不需要重启)
11.2<x<12.1
禁用自适应游标
alter system set "_optimizer_adaptive_cursor_sharing"= FALSE scope=both;
禁用扩展游标共享
alter system set "_optimizer_extended_cursor_sharing"=none scope=both;
alter system set "_optimizer_extended_cursor_sharing_rel"=none scope=both;
也可以限制父游标过时前,子游标数量(默认1024)
alter system set "_cursor_obsolete_threshold"=200 scope=both;
全部并重启实例(虽然参数生效不需要重启)
二、升级、打补丁到最新
问题二、
故障描述:
XX客户,12.2环境,备库,rman备份,报下面的错误,重启。
ORA-04031: unable to allocate 4160 bytes of shared memory ("shared pool","unknown object","init_heap_kfsg","ASM extent pointer array") (Doc ID 2705193.1)
trc文件:
<<portdg1_asmb_323924_i680531(1).trc>>
根本原因为init_heap_kfsg导致。
mos官方建议:
处理流程:
方向参考: