oracle等待事件查询,Oracle查看等待事件_yh_zeng2的博客-CSDN博客

--查询等待的会话ID , 阻塞的等待时间类型、事件ID 、 SQLID 等等信息 select *

from v$active_session_history h

where sample_time > trunc(sysdate)

and session_state = 'WAITING'

and exists(

select 1 from v$sql s

where upper(s.sql_text) like '%T_USER%'

and s.sql_id = h.sql_id

)

order by sample_time desc;

--会话阻塞的事件查询 select * from v$session_wait where sid = 148;

--会话发生过的所有等待事件查询 select s.time_waited/1000,s.* from v$session_event s where sid = 148;

--被锁了之后,查看持有该锁的会话查询 select a.sid blocker_sid,

a.serial#,

a.username as blocker_username,

b.type,

decode(b.lmode,0,'None',1,'Null',2,'Row share',3,'Row Exclusive',4,'Share',5,'Share Row Exclusive',6,'Exclusive') lock_mode,

b.ctime as time_held,

c.sid as waiter_sid,

decode(c.request,0,'None',1,'Null',2,'Row share',3,'Row Exclusive',4,'Share',5,'Share Row Exclusive',6,'Exclusive') request_mode,

c.ctime time_waited

from   v$lock b, v$enqueue_lock c, v$session a

where  a.sid = b.sid

and  b.id1= c.id1(+)

and  b.id2 = c.id2(+)

and  c.type(+) = 'TX'

and  b.type = 'TX'

and  b.block   = 1

and  c.sid = 148

order by time_held, time_waited;

--查询持有锁的会话执行了的SQL select s.sql_text,h.* from v$active_session_history h,v$sql s

where h.sql_id = s.sql_id

and h.session_id = 150;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值