-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Author       : Sameer S Choudhari
-- Description  : Find locked objects in the database
-- Call Syntax  : @locked_object.sql 
-- Last Modified: 17/03/2015
-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
COLUMN owner FOR a20
COLUMN object_name FOR a30
COLUMN program FOR a25
COLUMN osuser FOR a15
COLUMN object_type FOR a10
COLUMN machine FOR a25
ALTER SESSION SET nls_date_format='dd-MON-yyyy hh24:mi:ss';
SELECT o.owner,
       o.object_name,
       o.object_type,
       s.sid,
       s.serial#,
       s.status,
       s.osuser,
       s.machine,
       s.program,
       s.sql_id,
       s.logon_time,
       s.last_call_et
FROM v$locked_object l,
     v$session s,
     dba_objects o
WHERE s.sid=l.session_id
  AND l.object_id=o.object_id;