--查看被锁的对象
SELECT * FROM V$LOCKED_OBJECT;
--查看被锁对象
select object_name as 对象名称, s.sid, s.serial#, p.spid as 系统进程号
from v$locked_object l, dba_objects o, v$session s, v$process p
where l.object_id = o.object_id
and l.session_id = s.sid
and s.paddr = p.addr;
SELECT /*+ RULE */
LS.OSUSER OS_USER_NAME,
LS.USERNAME USER_NAME,
DECODE(LS.TYPE,
'RW',
'ROW WAIT ENQUIRE LOCK',
'TM',
'DML ENQUIRE LOCK',
'TX',
'TRANSACTION ENQUIRE LOCK',
'UL',
'USER SUPPLIED LOCK') LOCK_TYPE,
O.OBJECT_NAME OBJECT,
DECODE(LS.LMODE,
1,
NULL,
2,
'ROW SHARE',
3,
'ROW EXCLUSIVE',
4,
'SHARE',
5,
'SHARE ROW EXCLUSIVE',
6,
'EXCLUSIVE',
NULL) LOCK_MODE,
O.OWNER,
LS.SID,
LS.SERIAL# SERIAL_NUM,
LS.ID1,
LS.ID2
FROM SYS.DBA_OBJECTS O,
(SELECT S.OSUSER,
S.USERNAME,
L.TYPE,
L.LMODE,
S.SID,
S.SERIAL#,
L.ID1,
L.ID2
FROM V$SESSION S,
V$LOCK L
WHERE S.SID = L.SID) LS
WHERE O.OBJECT_ID = LS.ID1
AND O.OWNER<> 'SYS'
ORDER BY O.OWNER, O.OBJECT_NAME;
--处理
alter system kill session '48,49704' immediate;