当前位置:网站首页>DBA常用SQL语句 (5) - Latch 相关
DBA常用SQL语句 (5) - Latch 相关
2022-04-23 09:52:00 【Grainger】
DBA常用SQL语句:
DBA常用SQL语句(3)- cache、undo、索引和等待事件
Latch 相关SQL
检查 Latch 的相关 SQL查询当前数据库最繁忙的 Buffer,TCH(Touch)越大表示访问次数越高
SELECT *
FROM ( SELECT addr,
ts#,
file#,
dbarfil,
dbablk,
tch
FROM x$bh
ORDER BY tch DESC)
WHERE ROWNUM < 11;
查看 latch 的命中率
SELECT name, gets, misses, sleeps,
immediate_gets, immediate_misses
FROM v$latch
WHERE name = 'cache buffers chains';
查找数据块中的热点块
SELECT *
FROM (SELECT O.OWNER, O.OBJECT_NAME, O.OBJECT_TYPE, SUM(TCH)
TOUCHTIME
FROM X$BH B, DBA_OBJECTS O
WHERE B.OBJ = O.DATA_OBJECT_ID
AND B.TS# > 0
GROUP BY O.OWNER, O.OBJECT_NAME, O.OBJECT_TYPE
ORDER BY SUM(TCH) DESC)
WHERE ROWNUM <= 10;
根据文件号和块号查找数据库对象
select owner, segment_name, partition_name, tablespace_name
from dba_extents
where relative_fno = &v_dba_rfile and &v_dba_block between block_id and block_id +
blocks - 1;
如果在 Top 5 中发现 latch free 热点块事件时,可以从 V$latch_children 中查询具体的子Latch 信息
SELECT *
FROM (SELECT addr, child#, gets, misses, sleeps, immediate_gets igets,
immediate_misses imiss, spin_gets sgets
FROM v$latch_children
WHERE NAME = 'cache buffers chains'
ORDER BY sleeps DESC)
WHERE ROWNUM < 11;
查看引起 latch: cache buffers chains 的 sql
select * from (select
count(*),
sql_id,
nvl(o.object_name,ash.current_obj#) objn,
substr(o.object_type,0,10) otype,
3 4 5 6 CURRENT_FILE# fn,
CURRENT_BLOCK# blockn
from v$active_session_history ash
, all_objects o
where event like 'latch: cache buffers chains'
and o.object_id (+)= ash.CURRENT_OBJ#
group by sql_id, current_obj#, current_file#,
current_block#, o.object_name,o.object_type
order by count(*) desc )where rownum <=10;
版权声明
本文为[Grainger]所创,转载请带上原文链接,感谢
https://cloud.tencent.com/developer/article/1986061
边栏推荐
- MapReduce压缩
- [lnoi2014] LCA - tree chain subdivision - multipoint LCA depth and problems
- Prefix sum of integral function -- Du Jiao sieve
- 云身份过于宽松,为攻击者打开了大门
- SQL调优系列文章之—SQL调优简介
- SAP salv14 background output salv data can directly save files and send emails (with sorting, hyperlink and filtering format)
- How to use SQL statement union to get another column of another table when the content of a column in a table is empty
- C language: expression evaluation (integer promotion, arithmetic conversion...)
- Planning and construction of industrial meta universe platform
- Code source daily question div1 (701-707)
猜你喜欢

Windows安装redis并将redis设置成服务开机自启

自定义登录失败处理

如何实现根据照片获取地理位置及如何防御照片泄漏地理位置

《Redis设计与实现》

MapReduce压缩

SAP ECC connecting SAP pi system configuration

重载、重写、隐藏的对比

实践六 Windows操作系统安全攻防

Leetcode0587. Install fence

How to use SQL statement union to get another column of another table when the content of a column in a table is empty
随机推荐
ARM调试(1):两种在keil中实现printf重定向到串口的方法
2022年制冷与空调设备运行操作考试练习题及模拟考试
元宇宙时代的职业规划与执行
P1446 [hnoi2008] cards (Burnside theorem + DP count)
2022年上海市安全员C证考试题库及答案
杰理之有时候发现内存被篡改,但是没有造成异常,应该如何查找?【篇】
構建元宇宙時代敏捷制造的九種能力
Exclusive thoughts and cases of JS
DBA常用SQL语句(4)- Top SQL
Comparison of overloading, rewriting and hiding
"Gu Yu series" airdrop
Example of data object mask used by SAP translate
Chinese Remainder Theorem and extended Chinese remainder theorem that can be understood by Aunt Baojie
Longest common front string
Dropout技术之随机神经元与随机深度
从知识传播的维度对比分析元宇宙
MapReduce计算流程详解
论文阅读《Integrity Monitoring Techniques for Vision Navigation Systems》——5结果
论文阅读《Integrity Monitoring Techniques for Vision Navigation Systems》
杰理之用户如何最简单的处理事件【篇】