See: http://blog.yemou.net/article/query/info/tytfjhfascvhzxcyt108
In Oracle database operations, we sometimes use lock table queries and operations such as unlocking and kill processes, so how are these operations implemented? In this paper, we mainly introduce this part of the content.
(1) The Code of the Lock table query has the following form:
Select COUNT (*) from V$locked_object;
SELECT * from V$locked_object;
(2) See which table is locked
Select B.owner,b.object_name,a.session_id,a.locked_mode from V$locked_object a,dba_objects b where b.object_id = a.object_id;
(3) See which session is causing the
Select B.username,b.sid,b.serial#,logon_time from V$locked_object a,v$session b where a.session_id = B.sid ORDER by B.logo N_time;
(4) Kill the corresponding process
Execute command: Alter system kill session ' 1025,41 ';
1025 of them are sid,41 for serial#.
Oracle View lock and Release lock