oracle查看被锁的表和解锁

转自https://www.cnblogs.com/XQiu/p/5212787.html

相关表:

SELECT * FROM v$lock;
SELECT * FROM v$sqlarea;
SELECT * FROM v$session;
SELECT * FROM v$process ;
SELECT * FROM v$locked_object;
SELECT * FROM all_objects;
SELECT * FROM v$session_wait;

查出锁定表的sid, serial#,os_user_name, machine_name, terminal,锁的type,mode
SELECT s.sid, s.serial#, s.username, s.schemaname, s.osuser, s.process, s.machine,
s.terminal, s.logon_time, l.type
FROM v$session s, v$lock l
WHERE s.sid = l.sid
AND s.username IS NOT NULL
ORDER BY sid;

--杀掉进程 sid,serial#
alter system kill session'210,11562';

--查看被锁的表 
select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;

--查看那个用户那个进程照成死锁
select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time;


阅读更多
个人分类: 经验积累 oracle
上一篇关于Java和C#自带日期转换类的异常问题
下一篇Oracle 索引扫描的常用三种类型
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭