spool locking2.rslt 

set linesize 80;
set pagesize 1000;
set long 50;
set echo on;

break on "OWNER" on "TABLE NAME" on "INDEX NAME";
 
/* ************************************************ */
/*                                                  */
/* substitute the table_name variable with the new  */
/* name in CAPITAL LETTERS                          */
/*  - will show all the going on within the dbms    */
/*                                                  */
/*         @c:\oracle\sql\locking2.sql               */ 
/*                                                  */
/* ************************************************ */

/* ********************************************************* */
/* To ascertain process information, one can execute this    */
/*    query:                                                 */
/* ********************************************************* */
 
column "ORACLE USER" format a11
column SERIAL# format 9999999
column "OS USER" format a8
 
select distinct
     substr(s.username,1,11) "ORACLE USER", 
     p.pid "PROCESS ID",
     s.sid "SESSION ID", 
     s.serial#, 
     osuser "OS USER",
     p.spid "PROC SPID",
     s.process "SESS SPID", 
     s.lockwait "LOCK WAIT"
from v$process p, 
     v$session s, 
     v$access a
where a.sid      = s.sid   and
     p.addr      = s.paddr and
     s.username != 'SYS';
         
set echo off;
spool off;
set long 80;
commit;










