select /*+ RULE CURSOR_SHARING_EXACT */
substrb(vs1.username,1,10) "DB_USER_BL",
decode(vs1.lockwait,null,substrb(vs1.status,1,3),'WAI') "STA",
substrb(ltrim(to_char(vs1.inst_id,'9')||substrb(vs1.server,1,1)||substrb(to_char(vs1.sid),1,4)),1,6) "I-SID",
substrb(to_char(vs1.serial#),1,4) "SRL",
substrb(vp1.spid,1,8) spid,
substrb(vs2.username,1,10) "DB_USER_WA",
decode(vs2.lockwait,null,substrb(vs2.status,1,3),'WAI') "STA",
substrb(ltrim(to_char(vs2.inst_id,'9')||substrb(vs2.server,1,1)||substrb(to_char(vs2.sid),1,4)),1,6) "I-SID",
substrb(to_char(vs2.serial#),1,4) "SRL",
substrb(vp2.spid,1,8) spid,
lpad(substrb(decode(trunc(vl2.ctime/86400),0,
to_char(to_date(vl2.ctime,'SSSSS'),'HH24:MI:SS'),
to_char(trunc(vl2.ctime/86400),'B999999')),1,10),8) "WT-D/HMS"
from gv$session vs1, gv$session vs2, gv$process vp1, gv$lock vl1, gv$lock vl2, gv$process vp2
where vl1.block != 0
and vl1.sid = vs1.sid
and vl1.inst_id = vs1.inst_id
and vl1.id1 = vl2.id1
and vs1.paddr = vp1.addr(+)
and vs1.inst_id = vp1.inst_id(+)
and vl2.block = 0
and vl2.sid = vs2.sid
and vl2.inst_id = vs2.inst_id
and vs2.paddr = vp2.addr(+)
and vs2.inst_id = vp2.inst_id(+)
/
substrb(vs1.username,1,10) "DB_USER_BL",
decode(vs1.lockwait,null,substrb(vs1.status,1,3),'WAI') "STA",
substrb(ltrim(to_char(vs1.inst_id,'9')||substrb(vs1.server,1,1)||substrb(to_char(vs1.sid),1,4)),1,6) "I-SID",
substrb(to_char(vs1.serial#),1,4) "SRL",
substrb(vp1.spid,1,8) spid,
substrb(vs2.username,1,10) "DB_USER_WA",
decode(vs2.lockwait,null,substrb(vs2.status,1,3),'WAI') "STA",
substrb(ltrim(to_char(vs2.inst_id,'9')||substrb(vs2.server,1,1)||substrb(to_char(vs2.sid),1,4)),1,6) "I-SID",
substrb(to_char(vs2.serial#),1,4) "SRL",
substrb(vp2.spid,1,8) spid,
lpad(substrb(decode(trunc(vl2.ctime/86400),0,
to_char(to_date(vl2.ctime,'SSSSS'),'HH24:MI:SS'),
to_char(trunc(vl2.ctime/86400),'B999999')),1,10),8) "WT-D/HMS"
from gv$session vs1, gv$session vs2, gv$process vp1, gv$lock vl1, gv$lock vl2, gv$process vp2
where vl1.block != 0
and vl1.sid = vs1.sid
and vl1.inst_id = vs1.inst_id
and vl1.id1 = vl2.id1
and vs1.paddr = vp1.addr(+)
and vs1.inst_id = vp1.inst_id(+)
and vl2.block = 0
and vl2.sid = vs2.sid
and vl2.inst_id = vs2.inst_id
and vs2.paddr = vp2.addr(+)
and vs2.inst_id = vp2.inst_id(+)
/
No comments:
Post a Comment