Sunday 22 October 2017

Queries to find the DB locked object




select * from v$lock;

select C.OWNER,C.OBJECT_NAME,C.OBJECT_TYPE,B.sid,B.SERIAL#,B.STATUS,B.OSUSER,B.MACHINE
from V$LOCKED_OBJECT a
,    V$SESSION B
,    DBA_OBJECTS C
where 1=1
and   b.sid = a.session_id
and   a.OBJECT_ID = C.OBJECT_ID
;
select acc.*
from  DBA_DDL_LOCKS LOCKS
, V$ACCESS ACC
where 1=1
and LOCKS.session_id = ACC.sid
;
select * from  V$ACCESS;


select distinct B.sid,B.SERIAL#--c.object_id--C.OWNER,C.OBJECT_NAME,C.OBJECT_TYPE,B.sid,B.SERIAL#,B.STATUS,B.OSUSER,B.MACHINE
from V$LOCKED_OBJECT a
,    V$SESSION B
,    DBA_OBJECTS C
where 1=1
and   b.sid = a.session_id
and   a.OBJECT_ID = C.OBJECT_ID
--and c.object_id in (3384631,3384632)
and c.object_name = 'CONC_PROG_SHORT_NAME';

select acc.*
from  DBA_DDL_LOCKS LOCKS
, V$ACCESS ACC
where 1=1
and LOCKS.session_id = ACC.sid;

select * from  V$ACCESS;

SELECT SID,SERIAL#
FROM V$SESSION
WHERE SID IN (SELECT SESSION_ID
FROM DBA_DML_LOCKS
WHERE NAME = 'CONC_PROG_SHORT_NAME');

ALTER SYSTEM KILL SESSION 'SID,SERIALl#';
ALTER SYSTEM KILL SESSION '6247,5179';

No comments:

Post a Comment