Query to get the details of the lock in the database

Query to get the details of the lock in the database
How to find database locks
Oracle Apps EBS database locks

  SELECT NVL (s.username, 'Internal')            username,
         NVL (s.terminal, 'None')                terminal,
         l.SID || ',' || s.serial#               KILL,
         s.audsid                                oracle_session_id,
         u1.NAME || '.' || SUBSTR (t1.NAME, 1, 20) tab,
         DECODE (l.lmode,
                 1, 'No Lock',
                 2, 'Row Share',
                 3, 'Row Exclusive',
                 4, 'Share',
                 5, 'Share Row Exclusive',
                 6, 'Exclusive',
                 NULL)
            lmode,
         DECODE (l.request,
                 1, 'No Lock',
                 2, 'Row Share',
                 3, 'Row Exclusive',
                 4, 'Share',
                 5, 'Share Row Exclusive',
                 6, 'Exclusive',
                 NULL)
            request
    FROM v$lock  l,
         v$session s,
         SYS.user$ u1,
         SYS.obj$ t1
   WHERE     l.SID = s.SID
         AND t1.obj# = DECODE (l.id2, 0, l.id1, l.id2)
         AND u1.user# = t1.owner#
         AND s.TYPE != 'BACKGROUND'
ORDER BY 1, 2, 5
Related posts: Upload your own post and refer it anywhere anytime:

Leave a Reply