检查锁表的sql脚本

来源:互联网 发布:腾讯云域名过户 编辑:程序博客网 时间:2024/04/30 04:13

select V$SESSION.sid,v$session.SERIAL#,v$process.spid,
 rtrim(object_type) object_type,rtrim(owner) || '.' || object_name object_name,
 decode(lmode,   0, 'None',
            1, 'Null',
            2, 'Row-S',
            3, 'Row-X',
            4, 'Share',
            5, 'S/Row-X',
            6, 'Exclusive', 'Unknown') LockMode,
 decode(request, 0, 'None',
            1, 'Null',
            2, 'Row-S',
            3, 'Row-X',
            4, 'Share',
            5, 'S/Row-X',
            6, 'Exclusive', 'Unknown') RequestMode
            ,ctime, block b,
            v$session.username,MACHINE,MODULE,ACTION,
 decode(A.type,
    'MR', 'Media Recovery',
    'RT','Redo Thread',
    'UN','User Name',
    'TX', 'Transaction',
    'TM', 'DML',
    'UL', 'PL/SQL User Lock',
    'DX', 'Distributed Xaction',
    'CF', 'Control File',
    'IS', 'Instance State',
    'FS', 'File Set',
    'IR', 'Instance Recovery',
    'ST', 'Disk Space Transaction',
    'TS', 'Temp Segment',
    'IV', 'Library Cache Invalida-tion',
    'LS', 'Log Start or Switch',
    'RW', 'Row Wait',
    'SQ', 'Sequence Number',
    'TE', 'Extend Table',
    'TT', 'Temp Table',
    'Unknown') LockType
 from (SELECT * FROM V$LOCK) A, all_objects,V$SESSION,v$process
 where A.sid > 6
 and object_name<>'OBJ$'
 and A.id1 = all_objects.object_id
 and A.sid=v$session.sid
 and v$process.addr=v$session.paddr

 alter system kill session 'sid,serial#'; 

原创粉丝点击