Query to get the details of the lock in the database

By Amol Jadhav

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

SQL Querysql
1SELECT NVL (s.username, 'Internal')            username,
2         NVL (s.terminal, 'None')                terminal,
3         l.SID || ',' || s.serial#               KILL,
4         s.audsid                                oracle_session_id,
5         u1.NAME || '.' || SUBSTR (t1.NAME, 1, 20) tab,
6         DECODE (l.lmode,
7                 1, 'No Lock',
8                 2, 'Row Share',
9                 3, 'Row Exclusive',
10                 4, 'Share',
11                 5, 'Share Row Exclusive',
12                 6, 'Exclusive',
13                 NULL)
14            lmode,
15         DECODE (l.request,
16                 1, 'No Lock',
17                 2, 'Row Share',
18                 3, 'Row Exclusive',
19                 4, 'Share',
20                 5, 'Share Row Exclusive',
21                 6, 'Exclusive',
22                 NULL)
23            request
24    FROM v$lock  l,
25         v$session s,
26         SYS.user$ u1,
27         SYS.obj$ t1
28   WHERE     l.SID = s.SID
29         AND t1.obj# = DECODE (l.id2, 0, l.id1, l.id2)
30         AND u1.user# = t1.owner#
31         AND s.TYPE != 'BACKGROUND'
32ORDER BY 1, 2, 5

Related posts: