执行下列SQL,找到SID,serial#
select * from v$session t1, v$locked_object t2 where t1.sid = t2.SESSION_ID;
plsql下点击tools-----seeion 对应中文 工具------会话
找到对应的sid进程 点击关闭即可。
查看被锁的表
SELECT p.spid, a.serial#, c.object_name, b.session_id, b.oracle_username,b.os_user_name
FROM v$process p, v$session a, v$locked_object b, all_objects c
WHERE p.addr = a.paddr
AND a.process = b.process
AND c.object_id = b.object_id
命令行批量解锁
declare cursor mycur is
select b.sid,b.serial#
from v$locked_object a,v$session b
where a.session_id = b.sid group by b.sid,b.serial#;
begin
for cur in mycur
loop
execute immediate ( 'alter system kill session '''||cur.sid || ','|| cur.SERIAL# ||''' ');
end loop;
end;