Locking - Example Queries
-- Locking - Example Queries ------------------------------------------------------------------------------------------------------------
--  
--
select sid, serial#, osuser, username , program, module, status from v$session where osuser in('xyz','zzz');

select * from v$session@remotedb where osuser in ('xyz','zzz')
/
select * from v$session_longops@remotedb where sid = 24
/
select * from v$session_event@remotedb where sid = 24
/
select * from v$session_connect_info@remotedb where sid = 24
/
select * from v$process@remotedb
/
select * from v$enqueue_lock@remotedb
/

-- Show locks on system
select * from v$lock
/

-- Show sessions locking
select b.username,b.osuser,b.program,a.*
from v$lock a, v$session b
where a.sid = b.sid
--and b.osuser like 'nov%'
/

-- show locked objects
select * from v$locked_object
/
select substr(c.object_name,1,25) object_name, b.osuser, b.username, b.program, b.status
from v$locked_object a, v$session b, dba_objects c
where a.OBJECT_ID = c.OBJECT_ID(+) and a.SESSION_ID = b.SID(+)
;

-- showuser and lockwait
@oracle/scripts/showuser

-- display an object
select * from dba_objects where object_id = 2661
/