You can use the following SQL statement in PL/SQL to query which tables in the current database are locked and which users are locking these tables:
SELECT
A. OWNER, -- user to which the OBJECT belongs
A. OBJECT_NAME, -- OBJECT Name (table name)
B. XIDUSN,
B. XIDSLOT,
B. XIDSQN,
B. SESSION_ID, -- lock the table user's session
B. ORACLE_USERNAME, -- Oracle username of the table lock user
B. OS _USER_NAME, -- lock table user's operating system login Username
B. PROCESS,
B. LOCKED_MODE,
C. MACHINE, -- lock table user's computer name (for example, WORKGROUP \ UserName)
C. STATUS, -- lock Table STATUS
C. SERVER,
C. SID,
C. SERIAL #,
C. PROGRAM-database management tools used by table lock users (for example, ob9.exe)
FROM
ALL_OBJECTS,
V $ LOCKED_OBJECT B,
SYS. GV _ $ SESSION C
WHERE
A. OBJECT_ID = B. OBJECT_ID
And B. PROCESS = C. PROCESS
Order by 1 and 2 can be used to kill the items in the current lock table at the same time BY the following command:
Alter system kill session 'sid, serial #'
-- For example: alter system kill session '201801025'