查看被锁表:
select sess.sid,
sess.serial#,
lo.oracle_username,--登录账号
lo.os_user_name,--登录电脑
ao.object_name,--被锁表名
lo.locked_mode --锁住级别
from v$locked_object lo,dba_objects ao,v$session sess where ao.object_id=lo.object_id and lo.session_id=sess.sid;
解锁:
alter system kill session '66,245';--分别为SID,SERIAL#号
查看锁表语句:
SELECT A.USERNAME,
A.MACHINE,
A.PROGRAM,
A.SID,
A.SERIAL#,
A.STATUS,
C.PIECE,
C.SQL_TEXT
FROM V$SESSION A, V$SQLTEXT C
WHERE A.SID IN (SELECT DISTINCT T2.SID
FROM V$LOCKED_OBJECT T1, V$SESSION T2
WHERE T1.SESSION_ID = T2.SID)
AND A.SQL_ADDRESS = C.ADDRESS(+)
ORDER BY C.PIECE;