注册
阻塞事务和被阻塞事务查询
专栏/技术分享/ 文章详情 /

阻塞事务和被阻塞事务查询

醉酒方知浓 2025/08/01 115 0 0
摘要

with
lock_wait as(
SELECT l.addr,o.name as 阻塞对象, l.LMODE, l.trx_id, l.tid
FROM vlock l, sysobjects o WHERE l.table_id = o.id AND blocked = 1), waiting as ( select a.addr,a.阻塞对象,a.LMODE,b.user_name,b.clnt_host,b.clnt_ip,b.sess_id,'被阻塞的事务: '||b.sql_text,b.trx_id,b.state from lock_wait a inner join vsessions b on a.trx_id = b.trx_id),
waiting_for as (
select a.addr,a.阻塞对象,a.LMODE,b.user_name,b.clnt_host,b.clnt_ip,b.sess_id,'待提交的事务: '||b.sql_text,b.trx_id,b.state
from lock_wait a inner join v$sessions b on a.tid = b.trx_id)
select * from waiting_for union all
select * from waiting;

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服