当前位置: 首页 > news >正文

Oracle性能优化:latch free-SQL memory manager latch等待

我们的文章会在微信公众号IT民工的龙马人生和博客网站( www.htz.pw )同步更新 ,欢迎关注收藏,也欢迎大家转载,但是请在文章开始地方标注文章出处,谢谢!
由于博客中有大量代码,通过页面浏览效果更佳。

Oracle性能优化:latch free-SQL memory manager latch等待

环境:os :aix 5.3 db:10.2.0.5.8(rac)

1,业务运行慢,查看数据库发现其中一个节点高达700个的latch free等待

 I EVENT                                      COUNT(*)
-- ---------------------------------------- ----------1 latch free                                      634Backup: sbtwrite2                                12db file sequential read                           5enq: TX - row lock contention                     5SQL*Net message to client                         2gc cr request                                     1SQL*Net message from dblink                       1PX Deq: Execute Reply                             1PX Deq: Execution Msg                             1Streams AQ: waiting for messages in the           1queueenq: HW - contention                              1db file scattered read                            1SQL*Net message from client                       12 gc cr request                                     5enq: TX - row lock contention                     4db file sequential read                           3SQL*Net message from client                       3SQL*Net more data from dblink                     2PX Deq: reap credit                               1row cache lock                                    1db file scattered read                            1enq: HW - contention                              1direct path write                                 1

2,查看p1raw参数

 I EVENT                     p1text-p3text                            PROGRAM                       OSPID                USERNAME    STATE      SQL_ID          SESSION         ROW#
-- ------------------------- ---------------------------------------- ----------------------------- -------------------- ----------- ---------- --------------- --------------- --------------------1 latch free                address:07000000100275A0:number:00000000 JDBC Thin Client              6290:29285:4203526   CRM_APP     ACTIVE     8ubjuvyg6c534:0 1.6377          39:276458:1601426:000000123:tries:00000000000000041 latch free                address:07000000100275A0:number:00000000                               3356:65415:1799152   INTF        ACTIVE     9sc3q1pbcf7ub:0 1.1340          224:365803:745328:000000123:tries:00000000000000011 latch free                address:07000000100275A0:number:00000000                               3068:36861:5932380   INTF        ACTIVE     g5dw2wgy69pkk:1 1.2215          290:274969:1003114:000000123:tries:001 latch free                address:07000000100275A0:number:00000000                               3828:8055:5371066    INTF        ACTIVE     bp7y01nsbg2yf:0 1.3699          224:365745:371456:000000123:tries:00000000000000051 latch free                address:07000000100275A0:number:00000000 JDBC Thin Client              6189:54170:374336    CRM_APP     ACTIVE     c7anp2y57q6sk:0 1.6145          182:280702:59905:000000123:tries:00000000000000061 latch free                address:07000000100275A0:number:00000000                               1995:43649:585828    INTF        ACTIVE     bp7y01nsbg2yf:0 .               349:365774:1470739:000000123:tries:00000000000000011 latch free                address:07000000100275A0:number:00000000                               6788:10174:3511824   INTF        ACTIVE     7kfd65a8bszhc:0 .               169:365761:194049:000000123:tries:001 latch free                address:07000000100275A0:number:00000000 JDBC Thin Client              5849:10264:1266882   CRM_APP     ACTIVE     6ngvw9wu4gbs9:0 1.4200          272:280752:336829:000000123:tries:00000000000000021 latch free                address:07000000100275A0:number:00000000                               7233:43200:2066162   INTF        ACTIVE     bp7y01nsbg2yf:0 .               33:276550:1067233:000000123:tries:00000000000000011 latch free                address:07000000100275A0:number:00000000 JDBC Thin Client              3763:12952:1032272   CRM_APP     ACTIVE     3bnnt7f1ys1u8:0 1.6788          25:280860:472375:000000123:tries:00000000000000041 latch free                address:07000000100275A0:number:00000000                               1349:657:423594      INTF        ACTIVE     gja0421jrmvx3:0 .               81:275093:1423165:000000123:tries:0000000000000004

3,查看latch发生在什么资源上

SQL> select * from v$latch where addr='07000000100275A0';ADDR                 LATCH#     LEVEL# NAME                                                     HASH       GETS     MISSES     SLEEPS IMMEDIATE_GETS IMMEDIATE_MISSES WAITERS_WOKEN WAITS_HOLDING_LATCH  SPIN_GETS     SLEEP1     SLEEP2     SLEEP3     SLEEP4     SLEEP5     SLEEP6     SLEEP7     SLEEP8     SLEEP9    SLEEP10    SLEEP11  WAIT_TIME
---------------- ---------- ---------- -------------------------------------------------- ---------- ---------- ---------- ---------- -------------- ---------------- ------------- ------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
07000000100275A0        291          1 SQL memory manager latch                           3576695101   54948079   31722426   30087767        5156238            17318             0                   0    4727852          0          0          0          0          0          0          0          0          0          0          0 8.5347E+11

4,查看pga的使用情况

SQL> select sum(PGA_USED_MEM)/1024/1024/1024,sum(PGA_ALLOC_MEM)/1024/1024/1024 from v$process;SUM(PGA_USED_MEM)/1024/1024/1024 SUM(PGA_ALLOC_MEM)/1024/1024/1024
-------------------------------- ---------------------------------12.1002033                        15.1518837
SQL> select * from v$pgastat;NAME                                                                                  VALUE UNIT
---------------------------------------------------------------- -------------------------- ------------
aggregate PGA target parameter                                                  12884901888 bytes
aggregate PGA auto target                                                         805306368 bytes
global memory bound                                                                 1346560 bytes
total PGA inuse                                                                 12962652160 bytes
total PGA allocated                                                             16171951104 bytes
maximum PGA allocated                                                           18744916992 bytes
total freeable PGA memory                                                        1841692672 bytes
process count                                                                          5931
max processes count                                                                    6306
PGA memory freed back to OS                                                 254549278851072 bytes
total PGA used for auto workareas                                                 203935744 bytes
maximum PGA used for auto workareas                                              6624104448 bytes
total PGA used for manual workareas                                                       0 bytes
maximum PGA used for manual workareas                                               8601600 bytes
over allocation count                                                               1002554
bytes processed                                                             688458378573824 bytes
extra bytes read/written                                                     11514653887488 bytes
cache hit percentage                                                                     98 percent
recompute count (total)                                                            28378262SQL> select * from v$pgastat;NAME                                                                        VALUE UNIT
---------------------------------------------------------------- ---------------- ------------
aggregate PGA target parameter                                        12884901888 bytes
aggregate PGA auto target                                               805306368 bytes
global memory bound                                                       1186816 bytes
total PGA inuse                                                       12891575296 bytes
total PGA allocated                                                   16107764736 bytes
maximum PGA allocated                                                 18744916992 bytes
total freeable PGA memory                                              1835728896 bytes
process count                                                                6020
max processes count                                                          6306
PGA memory freed back to OS                                       254549830467584 bytes
total PGA used for auto workareas                                       202895360 bytesNAME                                                                        VALUE UNIT
---------------------------------------------------------------- ---------------- ------------
maximum PGA used for auto workareas                                    6624104448 bytes
total PGA used for manual workareas                                             0 bytes
maximum PGA used for manual workareas                                     8601600 bytes
over allocation count                                                     1002554
bytes processed                                                   688464160836608 bytes
extra bytes read/written                                           11515083701248 bytes
cache hit percentage                                                           98 percent
recompute count (total)                                                  28380736通过mos查询,发现是BUG导致的Bug 9732503  latch free waits for SQL Memory Manager latch / extra child cursors  This note gives a brief overview of bug 9732503.   The content was last updated on: 28-JUN-2013  Click here for details of each of the sections below.
Affects:Product (Component)
Oracle Server (Rdbms)
Range of versions believed to be affected
Versions BELOW 12.1
Versions confirmed as being affected• 11.2.0.1• 11.1.0.7• 10.2.0.5• 10.2.0.4
Platforms affected
Generic (all / most platforms affected)
Fixed:This issue is fixed in• 12.1.0.1 (Base Release)• 11.2.0.2 (Server Patch Set)• 11.1.0.7 Patch 36 on Windows Platforms
Symptoms:
Related To:• Latch Contention• Shared Pool Affected• Cursor not shared due to OPTIMIZER_MISMATCH• V$SQL• V$SQL_SHARED_CURSOR• PGA_AGGREGATE_TARGET• _smm_px_max_size
DescriptionWhen the parameter PGA_AGGREGATE_TARGET is set too low, Oracle might
experience a significant level of contention on the SQL Memory Manager latch.Rediscovery Notes:The statistic "recompute count (queries)" in v$pgastat will be high (non zero)and should increase when observing the contention.The latch shows waits for location "qesmmIQueryRefreshBound"This issue can also cause excess shared pool usage in the formof multiple child cursors created for SQL statements due to OPTIMIZER_MISMATCH in V$SQL_SHARED_CURSOR as the internal resizingcan cause some parameters that affect the optimizer environmentto change, notably _smm_px_max_sizeWorkaroundThis issue is often caused when the value of pga_aggregate_target is set toolow, ie. when the statistic "over allocation count" is non zero inv$pgastat. When this is the case, increase pga_aggregate_target such that itis set to at least "maximum PGA allocated" in v$pgastat. You can find moreinformation on tuning pga_aggregate_target in the Oracle tuning guide.Please note: The above is a summary description only. Actual symptoms can vary. Matching to any symptoms here does not confirm that you are encountering this problem. For questions about this bug please consult Oracle Support.
ReferencesBug:9732503 (This link will only work for PUBLISHED bugs)Note:245840.1 Information on the sections in this article

5,手动增加pga大小

SQL> alter system set pga_aggregate_target=20G ;System altered.SQL> show parameter sga;NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 45G
sga_target                           big integer 0
SQL> show parameter pgaNAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target                 big integer 20G

6,再次查询等待事件,一切正常

 I EVENT                                      COUNT(*)
-- ---------------------------------------- ----------1 Backup: sbtwrite2                                12db file sequential read                          11gc cr request                                     7gc buffer busy                                    3SQL*Net message from client                       3db file scattered read                            2gc current request                                2SQL*Net more data from client                     1buffer busy waits                                 1SQL*Net more data from dblink                     1SQL*Net message from dblink                       1PX Deq: Execute Reply                             1PX Deq: Execution Msg                             1Streams AQ: waiting for messages in the           1queue2 db file sequential read                           7gc cr request                                     3SQL*Net message from dblink                       3gc current request                                2SQL*Net message from client                       2SQL*Net message to client                         2latch: shared pool                                1latch: cache buffers chains                       1log file sync                                     1enq: TX - contention                              1db file parallel read                             1PX Deq: reap credit                               1

------------------作者介绍-----------------------
姓名:黄廷忠
个人博客: (http://www.htz.pw)
CSDN地址: (https://blog.csdn.net/wwwhtzpw)
博客园地址: (https://www.cnblogs.com/www-htz-pw)

http://www.jsqmd.com/news/32439/

相关文章:

  • 2025 年 11 月电能质量分析仪厂家权威推荐榜:A类/B类/动态/三相电能质量监测仪、在线监测装置及系统精选
  • 2025 年 11 月电气防火保护器厂家推荐排行榜,电弧故障保护器/断路器,防火限流保护器,故障电弧探测器,单相/三相保护装置专业选购指南
  • 如何将一个html以host方式运行跑起来
  • 2025年pc耐力板定制厂家权威推荐榜单:采光耐力板/pc实心板/pc阻燃板源头厂家精选
  • 原型污染攻击工具揭秘:Prototype Pollution Gadgets Finder
  • 2025 年 11 月箱包五金电镀加工,链条电镀加工,饰品电镀加工厂家最新推荐,产能、专利、环保三维数据透视!
  • IBM 3650M
  • 如何在Jmeter中测试接口查询天气
  • 2025 年胰岛素泵厂家排行榜权威发布,实力厂家技术与口碑全景解析及选购指南软针植入 / 平衡式留置针 / 无异物感胰岛素泵公司推荐
  • 2025年型材机加工生产厂家权威推荐榜单:硅溶胶精密铸造/砂铸件/五金铸件精加工源头厂家精选
  • 2025 年 11 月五金电镀加工,电子产品电镀加工,东莞电镀加工厂家最新推荐,产能、专利、环保三维数据透视!
  • 我用 Docker 部署 RabbitMQ 踩了 3 个大坑,10 分钟搞定的记录
  • Ubuntu 24.04.2 LTS 中修改远程桌面(xrdp)的默认端口
  • 在远程 Ubuntu 24.04.2 LTS 上安装并运行图形界面
  • 2025年安全检测检验公司排行榜单前十名推荐
  • 2025年安全检测检验公司排行榜单权威发布
  • 常见的命名规范
  • 2025年边坡防护网优质厂家权威推荐榜单:主动防护网/被动防护网/绞索网源头厂家精选
  • 2025年冷链食品冷库供货厂家权威推荐榜单:食品级冷库/食品速冻冷库/保鲜食品冷库源头厂家精选
  • 【触想智能】工控一体机在智慧农业应用领域具有巨大的潜力和发展空间
  • Day31-C:\Users\Lenovo\Desktop\note\code\JavaSE\Basic\src\com\Regex-正则表达式+爬虫
  • 在 Ubuntu 中创建一个拥有 root 权限的 mjroot 用户并禁用root用户
  • Mac微信4.0版本多开(暂不支持防撤回)
  • 2025年低烟无卤电缆加工厂权威推荐榜单:屏蔽电缆/计算机电缆/智能电缆源头厂家精选
  • 2025年度三维扫描系统品牌推荐,结构光与非接触式三维扫描仪企业全解析
  • 2025 年 11 月立式车床,双主轴立车车床,双主轴双刀塔车铣复合车床厂家最新推荐,技术实力与市场口碑深度解析!
  • CF1272F Two Bracket Sequences
  • 低功耗LCD段码液晶驱动 VKL144A/B LCD驱动厂家
  • 在Delphi中使用连接池连接MSSQL数据库和不使用连接池连接数据库的有什么区别
  • Go红队开发—图形化界面