REM reports what tables are locked by what processes

set pagesize 80;
set linesize 200;

column db_user format A20;
column db_table format A32;
column program format A35;
column lock_mode format A15;

PROMPT Current locks:
select a.osuser||’@’||a.machine db_user,a.program,c.object_name db_table,decode(b.locked_mode,3,’Shared’,5,’Exclusive’,b.locked_mode) lock_mode
from v$session a, v$locked_object b, all_objects c
where
a.type = ‘USER’ and
c.object_type = ‘TABLE’ and
a.sid = b.session_id and
b.object_id = c.object_id;

PROMPT Alternative view of (probably the same) locks:

select a.osuser||’@’||a.machine db_user,b.ctime seconds,decode(b.lmode,2,’Row share’,3,’Row exclusive’,4,’Table share’,6,’Table exclusive’,b.lmode) lock_mode
from v$session a,v$lock b
where
a.sid = b.sid and
a.type = ‘USER’;