1、查出被锁的表。
SELECT lpad(' ',decode(l.xidusn ,0,3,0))||l.oracle_username User_name,
o.owner,o.object_name,o.object_type,s.sid,s.serial#
FROM v$locked_object l,dba_objects o,v$session s
WHERE l.object_id=o.object_id
AND l.session_id=s.sid
ORDER BY o.object_id,xidusn DESC;
o.owner,o.object_name,o.object_type,s.sid,s.serial#
FROM v$locked_object l,dba_objects o,v$session s
WHERE l.object_id=o.object_id
AND l.session_id=s.sid
ORDER BY o.object_id,xidusn DESC;
我这里查询出有一个表被锁了:
2、解锁
--alter system kill session 'sid, serial#'
--根据查询出来的锁表记录的SID和SERIAL#来释放session
alter system kill session '4732, 21'
--根据查询出来的锁表记录的SID和SERIAL#来释放session
alter system kill session '4732, 21'
如果提示权限不足的话,请用DBA用户登录进行解锁操作。