1.查看数据库被锁的表
select a.object_name,
b.session_id,
c.serial#,
c.program,
c.username,
c.command,
c.machine,
c.lockwait
from all_objects a, vsession 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 vsession 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 ‘SID,SERIAL#’;
来源:CSDN
作者:lickybay
链接:https://blog.csdn.net/lickybay/article/details/103990637