lunes, 17 de febrero de 2014

Despliega que usuarios estan bloqueados por otros usuarios Oracle


col "Id" format 999999
col "Tipo" format a4
col "Modo Mantenido" format a20
col "Modo requerido" format a20
col "Id1" format 999999999

break on "Id1" skip 1

set pages 300
set head on
set lines 300
set verify off
set trimspool on
set feed on
set term on
set scan on
set timing on


SELECT /* HAGC */
M.Sid "Id",
M.Type "Tipo",
        DECODE (M.Lmode,
0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Excl.',
4, 'Share',
5, 'S/Row Excl.',
6, 'Exclusive',
        LTRIM(TO_CHAR(Lmode,'990'))) "Modo Mantenido",
        DECODE (M.Request,
0, 'None',
1, 'Null',
2, 'Row Share',
3, 'Row Excl.',
4, 'Share',
5, 'S/Row Excl.',
6, 'Exclusive',
        LTRIM(TO_CHAR(M.Request, '990'))) "Modo requerido",
        M.Id1 "Id1",
M.Id2
FROM
V$LOCK M
WHERE  (M.Request ! = 0)
        or
(M.Request = 0
and Lmode != 4
and (id1, id2) in
(
select
S.Id1,
S.Id2
from
V$LOCK S
where
Request != 0
and S.Id1 = M.Id1
and S.Id2 = M.Id2
)
)
order by
Id1,
Id2,
M.Request ;

set term on
set feed on
set verify on
set head on
set timing off

No hay comentarios:

Publicar un comentario