行锁阻塞分析

1、分析会话阻塞出现的时间段

select trunc(sample_time,'mi'),count(1) from dba_hist_active_sess_history where

sample_time>to_date('20200320 15:00:00','yyyymmdd hh24:mi:ss') and

sample_time

group by trunc(sample_time,'mi') having count(1)>2 order by 1;

2、分析会话阻塞的等待事件

select trunc(sample_time,'mi'),event,count(1) from dba_hist_active_sess_history where

sample_time>to_date('20200320 15:00:00','yyyymmdd hh24:mi:ss') and

sample_time2 order by 1,3;

3、定位会话阻塞源头

with ash as (select instance_number,session_id,event,blocking_session,program,to_char(sample_time,'YYYYMMDD HH24MISS') sample_time,sample_id,blocking_inst_id from dba_hist_active_sess_history where sample_time>to_date('20200320 15:00:00','yyyymmdd hh24:mi:ss') and

sample_time

select * from (

select sample_time,blocking_session final_block,sys_connect_by_path(session_id,',') sid_chain,sys_connect_by_path(event,',') enent_chain from ash start with session_id is not null

connect by prior blocking_session=session_id and

prior instance_number=blocking_inst_id and sample_id=prior sample_id)a

where instr(sid_chain,final_block)=0 and not exists

(select 1 from ash b where a.final_block=b.session_id and b.blocking_session is not null)

order by sample_time;

相关推荐

  1. mysql 表

    2024-03-16 16:06:01       36 阅读
  2. MySQL 表

    2024-03-16 16:06:01       16 阅读
  3. Mysql数据库——阻塞语句查询与分析

    2024-03-16 16:06:01       18 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-16 16:06:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-16 16:06:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-16 16:06:01       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-16 16:06:01       20 阅读

热门阅读

  1. 交叉编译代码

    2024-03-16 16:06:01       20 阅读
  2. ChatGPT升级版:如何借助ChatGPT高效撰写学术论文

    2024-03-16 16:06:01       24 阅读
  3. windows各个版本安装SSH

    2024-03-16 16:06:01       23 阅读
  4. CMake官方教程8--自定义命令和生成文件

    2024-03-16 16:06:01       19 阅读
  5. C#面:throw 和throw ex 的区别

    2024-03-16 16:06:01       18 阅读
  6. OpenXR 超详细spec--Chapter 2 基本原理

    2024-03-16 16:06:01       20 阅读
  7. 01、CMD与Hello world

    2024-03-16 16:06:01       18 阅读
  8. leetcode112.路径总和

    2024-03-16 16:06:01       19 阅读
  9. react面试题总结

    2024-03-16 16:06:01       20 阅读
  10. c语言:一颗红心两手准备(scanf函数的返回值)

    2024-03-16 16:06:01       18 阅读