加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

oracle查询阻塞与被阻塞SQL语句

(2017-10-28 17:18:01)
标签:

oracle

阻塞

被阻塞

sql语句

分类: Oracle
oracle查询阻塞与被阻塞SQL语句

# 环境:
操作系统
$ uname -a
Linux jinhu-db02 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 21 19:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/redhat-release 
CentOS release 6.9 (Final)
数据库
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production


select b.sid,
       a.sql_id,
       a.sql_text,
       a.hash_value,
       b.username,
       b.machine,
       a.module,
       decode(c.block, 1, 'blocking') blocking,
       decode(c.request, 0, 'null', 'blocked') blocked,
       to_char(b.logon_time, 'yyyy-mm-dd hh24:mi:ss')
  from v$sql a, v$session b, v$lock c
 where c.type = 'TX'
   and a.sql_id = b.sql_id
   and b.sid = c.sid
union all
select b.sid,
       a.sql_id,
       a.sql_text,
       a.hash_value,
       b.username,
       b.machine,
       a.module,
       decode(c.block, 1, 'blocking') blocking,
       decode(c.request, 0, 'null', 'blocked') blocked,
       to_char(b.logon_time, 'yyyy-mm-dd hh24:mi:ss')
  from v$sql a, v$session b, v$lock c
 where c.type = 'TX'
   and a.sql_id = b.prev_sql_id
   and b.sid = c.sid
   and c.block = 1
   
   
!!The End!!

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有