--查询所有用户锁:(执行解锁语句)注:dba用户登陆
SELECT DISTINCT T2.USERNAME,
'alter system kill session ''' || T2.SID || ',' ||
T2.SERIAL# || '''' || ';',
t3.OBJECT_NAME 被锁表名,
t4.SPID 进程号,
t2.OSUSER OS用户名,
t2.PROGRAM 程序名
FROM V$LOCKED_OBJECT T1
INNER JOIN V$SESSION T2
ON T1.SESSION_ID = T2.SID
INNER JOIN dba_objects T3
ON T1.OBJECT_ID = t3.OBJECT_ID
INNER JOIN v$process t4
ON t2.PADDR = t4.ADDR;
SELECT DISTINCT T2.USERNAME,
'alter system kill session ''' || T2.SID || ',' ||
T2.SERIAL# || '''' || ';',
t3.OBJECT_NAME 被锁表名,
t4.SPID 进程号,
t2.OSUSER OS用户名,
t2.PROGRAM 程序名
FROM V$LOCKED_OBJECT T1
INNER JOIN V$SESSION T2
ON T1.SESSION_ID = T2.SID
INNER JOIN dba_objects T3
ON T1.OBJECT_ID = t3.OBJECT_ID
INNER JOIN v$process t4
ON t2.PADDR = t4.ADDR;