码迷,mamicode.com
首页 > 数据库 > 详细

oracle 断开死锁用户

时间:2015-09-02 00:30:11      阅读:315      评论:0      收藏:0      [点我收藏+]

标签:

--查看最耗磁盘读写率的磁盘语句

 

select *

from (select v.sql_id,

v.child_number,

v.sql_text,

v.elapsed_time,

v.cpu_time,

v.disk_reads,

rank() over(order by v.disk_reads desc) elapsed_rank

from v$sql v) a

where elapsed_rank <= 10;

 

--查看产生表锁的语句,可以的到SID号

select * from v$lock where type=TX;

 

--查看会话,根据SID和serial#字段可以断开该会话

select * from v$session where sid=147;

select * from v$session where sid=138;

 

--查看产生死锁的机器

select username,sid,serial#,lockwait,status,machine,program from v$session where sid in 

(select session_id from v$locked_object)

 

--断开该会话

alter system kill session 138,45;

 

 

--查看产生死锁的SQL语句

select sql_text from v$sql where hash_value in 

(select sql_hash_value from v$session where sid in 

(select session_id from v$locked_object))

 

oracle 断开死锁用户

标签:

原文地址:http://www.cnblogs.com/houzhiqing/p/4777255.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!