Oracle kill session

  第一步:查询被锁表的所关联的session信息

 

SELECT A.OWNER,
       A.OBJECT_NAME,
       B.XIDUSN,
       B.XIDSLOT,
       B.XIDSQN,
       B.SESSION_ID,
       B.ORACLE_USERNAME,
       B.OS_USER_NAME,
       B.PROCESS,
       B.LOCKED_MODE,
       C.MACHINE,
       C.STATUS,
       C.SERVER,
       C.SID,
       C.SERIAL#,
       C.PROGRAM
  FROM ALL_OBJECTS A, V$LOCKED_OBJECT B, SYS.GV_$SESSION C
 WHERE (A.OBJECT_ID = B.OBJECT_ID)
   AND (B.PROCESS = C.PROCESS)

 

    第二步:释放Session

  

alter system kill session 'sid, serial#'

alter system kill session '379, 21132'
alter system kill session '374, 6938'

 

   不过这种情况只适合实体表,如果临时表被锁住,好像在V$Locked_OBJECT表中查不到记录

你可能感兴趣的:(oracle,C++,c,C#,OS)