zoukankan      html  css  js  c++  java
  • Script to show Active Distributed Transactions

    该脚本可以用于显示活跃的分布式事务(Distributed Transactions from dblink),可以协助诊断dblink远程事务:  
    REM distri.sql
    column origin format a13
    column GTXID format a35
    column LSESSION format a10
    column s format a1
    column waiting format a15
    Select /*+ ORDERED */
        substr(s.ksusemnm,1,10)||'-'|| substr(s.ksusepid,1,10) "ORIGIN",
        substr(g.K2GTITID_ORA,1,35) "GTXID",
        substr(s.indx,1,4)||'.'|| substr(s.ksuseser,1,5) "LSESSION" ,
        substr(decode(bitand(ksuseidl,11),
                   1,'ACTIVE',
                   0, decode(bitand(ksuseflg,4096),0,'INACTIVE','CACHED'),
                   2,'SNIPED',
                   3,'SNIPED', 'KILLED'),1,1) "S",
        substr(event,1,10) "WAITING"
    from  x$k2gte g, x$ktcxb t, x$ksuse s, v$session_wait w
    -- where  g.K2GTeXCB =t.ktcxbxba <= use this if running in Oracle7
    where  g.K2GTDXCB =t.ktcxbxba -- comment out if running in Oracle8 or later
       and g.K2GTDSES=t.ktcxbses
       and s.addr=g.K2GTDSES
       and w.sid=s.indx;
    
    REM distri_details.sql
    set headin off
    select /*+ ORDERED */
    '----------------------------------------'||'
    Curent Time : '|| substr(to_char(sysdate,'dd-Mon-YYYY HH24.MI.SS'),1,22) ||'
    '||'GTXID='||substr(g.K2GTITID_EXT,1,10) ||'
    '||'Ascii GTXID='||g.K2GTITID_ORA ||'
    '||'Branch= '||g.K2GTIBID ||'
    Client Process ID is '|| substr(s.ksusepid,1,10)||'
    running in machine : '||substr(s.ksusemnm,1,80)||'
      Local TX Id  ='||substr(t.KXIDUSN||'.'||t.kXIDSLT||'.'||t.kXIDSQN,1,10) ||'
      Local Session SID.SERIAL ='||substr(s.indx,1,4)||'.'|| s.ksuseser ||'
      is : '||decode(bitand(ksuseidl,11),1,'ACTIVE',0,
              decode(bitand(ksuseflg,4096),0,'INACTIVE','CACHED'),
              2,'SNIPED',3,'SNIPED', 'KILLED') ||
      ' and '|| substr(STATE,1,9)||
      ' since '|| to_char(SECONDS_IN_WAIT,'9999')||' seconds' ||'
      Wait Event is :'||'
      '||  substr(event,1,30)||' '||p1text||'='||p1
            ||','||p2text||'='||p2
            ||','||p3text||'='||p3    ||'
      Waited '||to_char(SEQ#,'99999')||' times '||'
      Server for this session:' ||decode(s.ksspatyp,1,'Dedicated Server',
                                              2,'Shared Server',3,
                                             'PSE','None') "Server"
    from  x$k2gte g, x$ktcxb t, x$ksuse s, v$session_wait w
    -- where  g.K2GTeXCB =t.ktcxbxba <= use this if running Oracle7
    where  g.K2GTDXCB =t.ktcxbxba -- comment out if running Oracle8 or later
       and  g.K2GTDSES=t.ktcxbses
       and  s.addr=g.K2GTDSES
       and  w.sid=s.indx;
    set headin on
    -- end script
     
  • 相关阅读:
    【BZOJ4769】超级贞鱼 归并排序求逆序对
    [简明版] 有道云笔记Markdown指南
    在Pycharm中配置Github
    Linux学习笔记之Xshell配色方案定制
    前端学习笔记之ES6快速入门
    魔改有道云笔记
    Python爬虫学习笔记之Centos下安装配置Mongodb3.6
    Linux学习笔记之CentOS6.9 防火墙的关闭以及开启
    Web前端学习笔记之jQuery选择器
    Django学习笔记之Queryset详解
  • 原文地址:https://www.cnblogs.com/macleanoracle/p/2967266.html
Copyright © 2011-2022 走看看