During Oracle database management, tables are often locked due to unreasonable operations on data tables. The following describes how to find which tables are locked.
During Oracle database management, tables are often locked due to unreasonable operations on data tables. The following describes how to find which tables are locked.
During Oracle database management, tables are often locked due to unreasonable operations on data tables. The following describes how to find which tables are locked by which users, and how to unlock:
1. Find the locked table:
Select object_name, session_id, OS _user_name, oracle_username, process, locked_mode, status
From v $ locked_object l, all_objects
Where l. object_id = a. object_id;
If you want to know which process is blocked, you can view the following statement:
Select username, v $ lock. sid, trunc (id1/power (2, 16) rbs, bitand (id1, to_number ('ffff', 'xxxx') + 0 slot, id2 seq, lmode, request from v $ lock, v $ session where v $ lock. type = 'tx 'and v $ lock. sid = v $ session. sid and v $ session. username = 'center ';
Or
Select
(Select username | ':' | sid | ':' | serial # from v $ session where sid = a. sid) |
'Blocked '|
(Select username | ':' | sid | ':' | serial # from v $ session where sid = B. sid)
From v $ lock a, v $ lock B
Where a. block = 1
And B. request> 0
And a. id1 = B. id1
And a. id2 = B. id2;
,