Oracle锁表查询与解锁

时间:2022-02-27 14:58:20

锁表查询和解锁

--查询
SELECT object_name, machine, s.sid, s.serial#
FROM gv$locked_object l, dba_objects o, gv$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid;

--将上面查询出来的sid ,serial 替换下面解锁SID,SERIAL

--解锁
alter system kill session 'SID, SERIAL#';

--执行上面解锁语句即可解锁表