Thursday, July 17, 2014

LOCKS HELD by USER

LOCKS HELD by USER

SELECT s.username, s.sid,
       DECODE (
          l.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',
          'DS', 'File Set',
          'IR', 'Instance Recovery',
          'ST', 'Disk Space Transaction',
          'TS', 'Temp Segment',
          'IV', 'Library Cache Invalidation',
          'LS', 'Log Start or Switch',
          'RW', 'Row Wait',
          'SQ', 'Sequence Number',
          'TE', 'Extend Table',
          'TT', 'Temp Table'
       ) ltype,
       o.object_name,
       DECODE (
          l.lmode,
          2, 'Row-S(SS)',
          3, 'Row-X(SX)',
          4, 'Share',
          5, 'S/Row-X(SSX)',
          6, 'Exclusive',
          'Other'
       ) mode_held
  FROM dba_objects o, v$session s, v$lock l
 WHERE s.sid = l.sid AND o.object_id = l.id1;

No comments:

Post a Comment