由SGA组件内存移动导致前台业务超时问题处理过程
墨墨导读:Oracle 11g推出了自动内存管理(AMM)新特性,该特性引入后,虽然减轻了DBA手动设置共享内存的负担,但是会存在不稳定的情况,经常出现在shared pool和buffer cache之间发生频繁shrink/grow操作的现象,特别是shared pool的shrink操作,在一些高并发环境下,可能引发数据库性能问题的风险,极端情况下,会导致数据库性能短时间内极速下降,在生产环境建议使用ASMM,因为从以往的经验来看,ASMM的稳定性高于AMM。
SQL> show parameter sgaNAME TYPE VALUE------------------------------------ ----------- ------------------------------lock_sga boolean FALSEpre_page_sga boolean FALSEsga_max_size big integer 206336Msga_target big integer 0SQL> show parameter targetNAME TYPE VALUE------------------------------------ ----------- ------------------------------archive_lag_target integer 0db_flashback_retention_target integer 1440fast_start_io_target integer 0fast_start_mttr_target integer 0memory_max_target big integer 206336Mmemory_target big integer 206336Mparallel_servers_target integer 32pga_aggregate_target big integer 0sga_target big integer 0SQL> show parameter pgaNAME TYPE VALUE------------------------------------ ----------- ------------------------------pga_aggregate_target big integer 0SQL>
自动内存管理(AMM) : memory_target=非0,是自动内存管理,如果初始化参数 LOCK_SGA=TRUE,则 AMM 是不可用的。
自动共享内存管理(ASMM): 在memory_target=0 and sga_target为非0的情形下是自动内存管理
手工共享内存管理 : memory_target=0 and sga_target=0 指定 share_pool_size 、db_cache_size 等 sga 参数
自动 PGA 管理 : memory_target=0 and workarea_size_policy=auto and PGA_AGGREGATE_TARGET=值
手动 PGA 管理 : memory_target=0 and workarea_size_policy=manal 然后指定 SORT_AREA_SIZE 等 PGA 参数,一般不使用手动管理PGA。
SQL> set linesize 600
SQL> col component for a25
SQL> col oper_type for a15
SQL> col oper_mode for a10
SQL> col parameter for a25
SQL> col initial_size for 999999999999
SQL> col final_size for 99999999999
SQL> select component,
2 oper_type,
3 oper_mode,
4 parameter,
5 initial_size,
6 target_size,
7 final_size,
8 status,
9 start_time,
10 end_time as changed_time
11 from V$SGA_RESIZE_OPS
12 where to_char(end_time,'yyyy-mm-dd hh')='2020-12-31 12'
13 order by end_time;
COMPONENT OPER_TYPE OPER_MODE PARAMETER INITIAL_SIZE TARGET_SIZE FINAL_SIZE STATUS START_TIME CHANGED_TIME
------------------------- --------------- ---------- ------------------------- ------------- ----------- ------------ --------- ------------------- -------------------
shared pool SHRINK DEFERRED shared_pool_size 19327352832 1.8790E+10 18790481920 COMPLETE 2020-12-31 12:38:59 2020-12-31 12:40:42
DEFAULT buffer cache GROW DEFERRED db_cache_size 51002736640 5.1540E+10 51539607552 COMPLETE 2020-12-31 12:38:59 2020-12-31 12:40:42
DEFAULT buffer cache SHRINK IMMEDIATE db_cache_size 51539607552 5.1003E+10 51002736640 COMPLETE 2020-12-31 12:40:42 2020-12-31 12:40:44
shared pool GROW IMMEDIATE shared_pool_size 18790481920 1.9327E+10 19327352832 COMPLETE 2020-12-31 12:40:42 2020-12-31 12:40:44
DEFAULT buffer cache SHRINK IMMEDIATE db_cache_size 51002736640 5.0466E+10 50465865728 COMPLETE 2020-12-31 12:40:44 2020-12-31 12:40:47
shared pool GROW IMMEDIATE shared_pool_size 19327352832 1.9864E+10 19864223744 COMPLETE 2020-12-31 12:40:44 2020-12-31 12:40:47
SQL> show parameter target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target integer 0
db_flashback_retention_target integer 1440
fast_start_io_target integer 0
fast_start_mttr_target integer 0
memory_max_target big integer 0
memory_target big integer 0
parallel_servers_target integer 32
pga_aggregate_target big integer 50G
sga_target big integer 280G
SQL> show parameter db_cache_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_cache_size big integer 100G
SQL> show parameter shared_pool_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
shared_pool_size big integer 60G
[oracle@xsdbd31 ~]$ grep -i huge /proc/meminfo
AnonHugePages: 1587200 kB
HugePages_Total: 143380
HugePages_Free: 13567
HugePages_Rsvd: 13548
HugePages_Surp: 0
Hugepagesize: 2048 kB
李培杨,云和恩墨西区交付技术顾问,有多年数据库运维经验,长期服务于运营商企业,国有企业等客户,擅长Oracle故障诊断,性能优化,备份恢复,以及升级迁移;擅长DB2故障诊断,性能优化,升级迁移,特殊恢复等。
墨天轮原文链接:https://www.modb.pro/db/44295(复制到浏览器中打开或者点击“阅读原文”立即查看)
赞 (0)