--查询锁表
SELECT /*+ rule */ s.username,
decode(l.type,'TM','TABLE LOCK','TX','ROW LOCK',NULL) LOCK_LEVEL,
o.owner,
o.object_name,
o.object_type,
s.sid,
s.serial#,
s.STATUS,
s.terminal,
s.machine,
s.program,
s.osuser,
s.LOGON_TIME
FROM v$session s,
v$lock l,
dba_objects o
WHERE l.sid = s.sid
AND l.id1 = o.object_id(+)
AND s.username is NOT NULL
and s.status ='ACTIVE'
-----
用sys登陆
SELECT A.SID,A.SERIAL#,A.USERNAME,B.TYPE FROM V$SESSION A,V$LOCK B WHERE A.SID=B.SID;
--用下面的命令解锁
ALTER SYSTEM KILL SESSION 'SID,SERIAL#';
SELECT /*+ rule */ s.username,
decode(l.type,'TM','TABLE LOCK','TX','ROW LOCK',NULL) LOCK_LEVEL,
o.owner,
o.object_name,
o.object_type,
s.sid,
s.serial#,
s.STATUS,
s.terminal,
s.machine,
s.program,
s.osuser,
s.LOGON_TIME
FROM v$session s,
v$lock l,
dba_objects o
WHERE l.sid = s.sid
AND l.id1 = o.object_id(+)
AND s.username is NOT NULL
and s.status ='ACTIVE'
-----
用sys登陆
SELECT A.SID,A.SERIAL#,A.USERNAME,B.TYPE FROM V$SESSION A,V$LOCK B WHERE A.SID=B.SID;
--用下面的命令解锁
ALTER SYSTEM KILL SESSION 'SID,SERIAL#';