日期:2014-05-16  浏览次数:20530 次

查询数据库表被哪个进程锁定的语句
查询数据库表被哪个进程锁定的语句,以'PTL_PARAMETER'为例,查看'PTL_PARAMETER'表被哪些用户锁定了:
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 )
and A.Object_Name = 'PTL_PARAMETER'
ORDER BY 1,2