Oracle表被锁以及如何解锁的语句

1.查看表是否被锁定的语句

select a.object_name,b.session_id,c.serial#,c.program,
c.username,c.command,c.machine,c.lockwait 
from all_objects a,v$locked_object b,v$session c 
where a.object_id=b.object_id and c.sid=b.session_id;

2.查看被锁定的表的信息

select l.session_id sid, 

       s.serial#, 

       l.locked_mode, 

       l.oracle_username, 

       s.user#, 

       l.os_user_name, 

       s.machine, 

       s.terminal, 

       a.sql_text, 

       a.action
       
       from v$sqlarea a, v$session s, v$locked_object l 

where l.session_id = s.sid 

   and s.prev_sql_addr = a.address 

order by sid, s.serial#;

3.解锁表


alter system kill session '19';#这里的19是session_id
上一篇:【算法与数据结构系列】「线程锁算法专项」初探CLH队列锁机制原理分析


下一篇:二分查找BinarySearch(Java)