正德厚生,臻于至善

lock.sql

select /*+rule*/
 decode(l.lmode, 0, '<==waiter', 6, '==>holder') identifier,
 s.status,
 s.sql_id,
 s.logon_time,
 s.module,
 s.sid,
 s.serial#,
 s.inst_id,
 p.spid,s.SQL_EXEC_ID,
 'alter system kill session ''' || s.sid || ',' || s.serial# || ',@'|| s.INST_ID || ''';' kill_a,
 decode(l.lmode,
        0,
        'None',
        1,
        'Null',
        2,
        'Row-x (SX)',
        4,
        'Share',
        5,
        'S/Row-X (SSX)',
        6,
        'Exclusive',
        to_char(l.lmode)) hold,
 decode(l.request,
        0,
        'None',
        1,
        'Null',
        2,
        'Row-x (SX)',
        4,
        'Share',
        5,
        'S/Row-X (SSX)',
        6,
        'Exclusive',
        to_char(l.request)) requested,
 to_char(l.id1) lock_id1,
 to_char(l.id2) lock_id2,
 l.ctime,
 s.row_wait_obj#,
 s.process,
 s.action,
 decode(l.type,
        'CF',
        'Control File',
        'DX',
        'Distributed Xaction',
        'FS',
        'File Set',
        'IR',
        'Instance Recovery',
        'IS',
        'Instance State',
        'IV',
        'Library Cache Invalidation',
        'LS',
        'Log Start or Switch',
        'MR',
        'Media Recovery',
        'RT',
        'Redo Thread',
        'RW',
        'Row Wait',
        'SQ',
        'Sequence Number',
        'ST',
        'Disk Space Transaction',
        'TE',
        'Extend Table',
        'TM',
        'DML',
        'TS',
        'Temp Table',
        'TX',
        'Transaction',
        'UL',
        'PL/SQL User Lock',
        'UN',
        'User Name',
        l.type) Lock_type,
 s.program,
 s.command,
 s.terminal,
 s.machine,
 s.client_info,
 s.logon_time,
 s.last_call_et,
 s.client_identifier,
 s.username,
 s.osuser,
 s.schemaname,
 s.paddr
  from gv$lock l, gv$session s, gv$process p
 where (l.id1, l.id2, l.type) in
       (select /*+ no_merge*/
         gl.id1, gl.id2, gl.type
          from gv$lock gl
         where request != 0)
   and l.sid = s.sid
   and l.inst_id = s.inst_id
   and s.paddr = p.addr(+)
   and s.inst_id = p.inst_id(+)
 order by 1 desc, l.id1;
赞(0) 打赏
未经允许不得转载:徐万新之路 » lock.sql

支持快讯、专题、百度收录推送、人机验证、多级分类筛选器,适用于垂直站点、科技博客、个人站,扁平化设计、简洁白色、超多功能配置、会员中心、直达链接、文章图片弹窗、自动缩略图等...

联系我们

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

登录

找回密码

注册