1.查询引起了锁表的原因
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#;
2.查询被锁的表
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
3.查看是哪个session引起的
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
4.杀掉对应进程即解锁
alter system kill session'135,397'
--其中135是sid 397是serial#
标签:locked,锁表,object,session,sid,oracle,serial,id From: https://www.cnblogs.com/wellwellwell/p/17276019.html