When we operate databases, database tables may be locked due to improper operations, so we are often at a loss and do not know how to unlock these tables, the "sessions" in the menu "tools" of pl/SQL Developer can query existing sessions, but it is difficult to find that session is locked, it is more difficult to find the locked session.
The following is a simple and easy-to-use process of unlocking an effective kill process through the combination of online materials and on-site environment:
View the locked table:
SELECT p. spid,
C. object_name,
B. session_id,
A. serial #,
B. oracle_username,
B. OS _user_name
FROM v $ process p, v $ session a, v $ locked_object B, all_objects c
WHERE p. addr = a. paddr
AND a. process = B. process
AND c. object_id = B. object_id;
Record the queried session_id and serial # and use the following statement to unlock them.
Unlock:
Alter system kill session 'B. session_id, a. serial #';
If the unlock fails, you can try to end the process at the operating system level (powerful, use with caution)
[Windows] ntsd-c q-pp. spid
[Linux] ps-ef | grepp. spid
In linux, KILL the system process first. In some cases, kill-9 spid is used.
I have used the above methods to solve this problem several times and have not encountered any invalid problems yet.
I hope to help you.