Friday, June 8, 2012

Check who Use the same record you want to delete

Just Run the Below Script and after this kill the session :


  select owner||'.'||object_name obj
 ,oracle_username||' ('||s.status||')' oruser
 ,os_user_name osuser
 ,machine computer
 ,l.process unix
 ,'||s.sid||','||s.serial#||' ss
 ,r.name rs
 ,to_char(s.logon_time,'yyyy/mm/dd hh24:mi:ss') time
 from       v$locked_object l
 ,dba_objects o
 ,v$session s
 ,v$transaction t
 ,v$rollname r
 where l.object_id = o.object_id
and s.sid=l.session_id
and s.taddr=t.addr
and t.xidusn=r.usn
order by osuser, ss, obj ;


To kill the session : 

Alter System kill Session 'Sid,Serail#' immediate ;

Thank you
Osama mustafa

1 comment:

  1. this topic Would be, Check who Use the same table you want to delete,
    this above query Display Tables not the particular record

    thank-you


    ReplyDelete