How to Unlock the Objects
SELECT dbo.object_id, dbo.OBJECT_NAME
FROM all_objects dbo, V$LOCKED_OBJECT loc
WHERE loc.object_id = dbo.object_id
To list the Locked Objects
Select * from V$LOCKED_OBJECT
1. Get the object ID of the locked table:
SELECT object_id, OBJECT_NAME FROM dba_objects WHERE OBJECT_ID=27557 -- object_name='YOUR TABLE NAME';
2. Get the SID values for this ID:
SELECT sid FROM v$lock WHERE id1= 44965 --OBJECT ID FROM STEP1
3. Get the session values for these SIDs:
SELECT sid, serial# from v$session where sid in (2973) -- (COMMA SEPARATED LIST OF SIDs FROM STEP2.)
4. Kill the sessions causing the lock:
ALTER SYSTEM KILL SESSION (SID,SERIAL#) pair values from step 3
e.g. ALTER SYSTEM KILL SESSION '2971,36'
ALTER SYSTEM KILL SESSION '2973,56842'
SELECT dbo.object_id, dbo.OBJECT_NAME
FROM all_objects dbo, V$LOCKED_OBJECT loc
WHERE loc.object_id = dbo.object_id
To list the Locked Objects
Select * from V$LOCKED_OBJECT
1. Get the object ID of the locked table:
SELECT object_id, OBJECT_NAME FROM dba_objects WHERE OBJECT_ID=27557 -- object_name='YOUR TABLE NAME';
2. Get the SID values for this ID:
SELECT sid FROM v$lock WHERE id1= 44965 --OBJECT ID FROM STEP1
3. Get the session values for these SIDs:
SELECT sid, serial# from v$session where sid in (2973) -- (COMMA SEPARATED LIST OF SIDs FROM STEP2.)
4. Kill the sessions causing the lock:
ALTER SYSTEM KILL SESSION (SID,SERIAL#) pair values from step 3
e.g. ALTER SYSTEM KILL SESSION '2971,36'
ALTER SYSTEM KILL SESSION '2973,56842'
No comments:
Post a Comment