`

Oracle 找锁住的表并解锁

 
阅读更多

select a.sid,b.serial#,b.PROGRAM,b.USERNAME,b.MACHINE,b.OSUSER,b.LOGON_TIME,b.LAST_CALL_ET,b.process,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,
        rtrim(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
from v$lock a,all_objects c,v$session b
where a.sid > 6 and a.id1 = c.object_id and a.sid = b.sid;
 

 

 

生成Kill语句

 

select 'alter system kill session '''||a.sid||','||b.serial#||''';'
from v$lock a,all_objects c,v$session b
where a.sid > 6 and a.id1 = c.object_id and a.sid = b.sid;
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics