当前位置:网站首页>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
边栏推荐
- 自定义登录失败处理
- JS DOM learn three ways to create elements
- Nine abilities of agile manufacturing in the era of meta universe
- DBA常用SQL语句(4)- Top SQL
- Redis 异常 read error on connection 解决方案
- kernel-pwn学习(3)--ret2user&&kernel ROP&&QWB2018-core
- Redis expired key cleaning and deletion policy summary
- 杰理之有时候定位到对应地址的函数不准确怎么办?【篇】
- Comparison of overloading, rewriting and hiding
- NEC红外遥控编码说明
猜你喜欢

Epidemic prevention registration applet

2022年上海市安全员C证考试题库及答案

Yarn核心参数配置

C language: expression evaluation (integer promotion, arithmetic conversion...)

SAP ECC connecting SAP pi system configuration

Solving Lucas number and combination theorem

JS what is an event? Event three elements and operation elements

Nvidia最新三维重建技术Instant-ngp初探

中控学习型红外遥控模块支持网络和串口控制
MapReduce核心和基础Demo
随机推荐
2022茶艺师(初级)考试试题模拟考试平台操作
云身份过于宽松,为攻击者打开了大门
The central control learning infrared remote control module supports network and serial port control
个人主页软件Fenrus
Educational Codeforces Round 81 (Rated for Div. 2)
Dropout技术之随机神经元与随机深度
JS and how to judge custom attributes in H5
"Gu Yu series" airdrop
Epidemic prevention registration applet
Pyqt5 and communication
formatTime时间戳格式转换
杰理之更准确地确定异常地址【篇】
Leetcode题库78. 子集(递归 c实现)
[COCI] Vje š TICA (subset DP)
kernel-pwn学习(3)--ret2user&&kernel ROP&&QWB2018-core
Odoo 服务器搭建备忘
Mobius inversion
Code source daily question div1 (701-707)
SQL调优系列文章之—SQL调优简介
Computer network security experiment II DNS protocol vulnerability utilization experiment