- --查看等待事件
- SELECT W.EVENT, S.STATUS, Q.SQL_TEXT
- FROM V$SESSION_WAIT W, V$SESSION S, V$SQL Q
- WHERE W.SID = S.SID
- AND Q.HASH_VALUE = S.SQL_HASH_VALUE
- AND W.EVENT NOT LIKE '%message from client%'
- AND S.SID =&yoursid ;
- --查看谁锁住的
- select t2.username
- from v$locked_object t1,v$session t2
- where t1.session_id=t2.sid order by t2.logon_time
- --解锁
- select t2.username,t2.sid,t2.serial#,t2.logon_time,t3.object_name
- from v$locked_object t1,v$session t2 ,user_objects t3
- where t1.session_id=t2.sid and t1.object_id = t3.object_id order by t2.logon_time
- -- kill之:
- alter system kill session 'sid,serial#';
查询:
- SELECT s.sid, s.serial#, s.username, s.schemaname, s.osuser, s.process, s.machine,
s.terminal, s.logon_time, l.type
FROM v$session s, v$lock l
WHERE s.sid = l.sid
AND s.username IS NOT NULL
ORDER BY sid; -
alter system kill session '21,11374';