@data
col logon_time for a20
col block for 99
col id1 for 9999999
col ctime for 9999999
col lmode for 99
col request for 99
col username for a15
SELECT /*+rule*/ s.sid, s.username, s.process, s.sql_id, s.prev_sql_id, s.status, s.server, s.logon_time, l.id1, l.lmode, l.request, l.ctime, l.block
FROM v$session s
join v$lock l on (l.sid = s.sid)
WHERE request=6
union
SELECT /*+rule*/ s.sid, s.username, s.process, s.sql_id, s.prev_sql_id, s.status, s.server, s.logon_time, l.id1, l.lmode, l.request, l.ctime, l.block
FROM v$session s
join v$lock l on (l.sid = s.sid)
WHERE id1 in
(SELECT /*+rule*/ id1
FROM v$lock
WHERE request=6)
ORDER BY id1, lmode desc;