--接着根据blocking_seesin=61,查询: SQL> select sid,serial#,sql_id,status,event,blocking_session, ROW_WAIT_OBJ#,ROW_WAIT_FILE#,ROW_WAIT_BLOCK#,ROW_WAIT_ROW# from v$session where sid=61;
SID SERIAL# SQL_ID STATUS EVENT BLOCKING_SESSION ROW_WAIT_OBJ# ROW_WAIT_FILE# ROW_WAIT_BLOCK# ROW_WAIT_ROW# ---------- ---------- ------------- -------- ---------------------------------------------------------------- ---------------- ------------- -------------- --------------- ------------- 61 721 INACTIVE SQL*Net message from client -1 0 0 0 --找到原因sid,杀掉: SQL> alter system kill session '61,721' immediate;
System altered.
SQL>
--发现session 2已经提交了 SQL> update t_all_objs set object_name='test101' where object_id=2013011701; 1 row updated.
--commit提交后查询 SQL> commit;
Commit complete.
SQL> select * from t_all_objs;
OWNER OBJECT_ID OBJECT_NAME ------------------------------ ---------- ------------------------------ TEST 2013011701 test101 TEST 2013011702 test2
SQL>
============================================================================================ 或者直接用如下三种方法排查: select SID,TYPE,ID1,ID2,LMODE,REQUEST,CTIME,BLOCK from V$lock where block=1 or request<>0; SID TY ID1 ID2 LMODE REQUEST CTIME BLOCK ---------- -- ---------- ---------- ---------- ---------- ---------- ---------- 59 TX 393249 10702 0 6 127 0 61 TX 393249 10702 6 0 135 1 select a.sid hold_sid, b.sid wait_sid, a.type, a.id1, a.id2, a.ctime from v$lock a, v$lock b where a.id1 = b.id1 and a.id2 = b.id2 and a.block = 1 and b.block = 0; HOLD_SID WAIT_SID TY ID1 ID2 CTIME ---------- ---------- -- ---------- ---------- ---------- 61 59 TX 393249 10702 108 select decode(request,0,'holder: ','waiter: ') || sid session_id, id1, id2, lmode, request, type from v$lock where (id1, id2, type) in (select id1, id2, type from v$lock where request > 0) order by id1, request; SESSION_ID ID1 ID2 LMODE REQUEST TY ------------------------------------------------ ---------- ---------- ---------- ---------- -- holder: 61 393249 10702 6 0 TX waiter: 59 393249 10702 0 6 TX