Oracle Database Lock table query and unlock process
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.
The code for a lock table query is in the following form:
Select COUNT (*) from V$locked_object;
SELECT * from V$locked_object;
See which table is locked
1.select B.owner,b.object_name,a.session_id,a.locked_mode
2. From V$locked_object a,dba_objects b
3. Where b.object_id = a.object_id;
See which session caused it.
1. Select B.username,b.sid,b.serial#,logon_time
2.from V$locked_object a,v$session b
3.where a.session_id = b.sid ORDER by B.logon_time;
Kill the corresponding process
Execute command: Alter system kill session ' 1025,41 ';
1025 of them are sid,41 for serial#.
About the Oracle lock table query and unlock kill process related knowledge is introduced here, I hope this introduction can have a harvest for you!
Oracle Database Lock table query and unlock process