1. view the database lock and diagnose the source and type of the lock:
Select object_id, session_id, locked_mode from v $ locked_object;
Or run the following command:
Select B. owner, B. object_name, l. session_id, l. locked_mode
From v $ locked_object l, dba_objects B
Where B. object_id = l. object_id
SELECT lpad ('', decode (l. xidusn, 0,3, 0) | l. Oracle_username User_name,
O. owner, o. object_name, o. object_type, s. sid, s. serial #
FROM v $ locked_object l, dba_objects o, v $ session s
WHERE l. object_id = o. object_id
AND l. session_id = s. sid
Order by o. object_id, xidusn DESC
2. Find the database's serial # For killing:
Select t2.username, t2.sid, t2.serial #, t2.logon _ time
From v $ locked_object t1, v $ session t2
Where t1.session _ id = t2.sid order by t2.logon _ time;
3. Kill the session
Alter system kill session 'sid, serial #'
Use the record found in step 2 to delete the statement.