Oracle锁表与解锁

2021/12/29 19:12:20

本文主要是介绍Oracle锁表与解锁,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Oracle的锁表与解锁

SELECT /*+ rule */ s.username,
decode(l.type,'TM','TABLE LOCK',
'TX','ROW LOCK',
NULL) LOCK_LEVEL,
o.owner,o.object_name,o.object_type,
s.sid,s.serial#,s.terminal,s.machine,s.program,s.osuser
FROM v$session s,v$lock l,dba_objects o
WHERE l.sid = s.sid
AND l.id1 = o.object_id(+)
AND s.username is NOT Null

--kill session语句
alter system kill session'50,492';
\\\

select count(*) from v$locked_object;

  select * from v$locked_object;

  查看哪个表被锁

  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;

  查看是哪个session引起的

  1. 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;

  杀掉对应进程

  执行命令:alter system kill session'1025,41';



这篇关于Oracle锁表与解锁的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程