The following SQL statements can be used in Pl/sql to query which tables in the current database are locked and which users lock them:
SELECT
A.owner,--object owned user
A.object_name,--object name (table name)
B.XIDUSN,
B.xidslot,
B.XIDSQN,
B.SESSION_ID,--Session of lock table user
B.oracle_username,--lock table user's ORACLE username
B.os_user_name,--lock table user's operating system login username
B.process,
B.locked_mode,
C.machine,--the computer name of the user who locked the table (for example: Workgroup\username)
C.status,--lock table state
C.server,
C.sid,
c.serial#,
C.program-the database management tool used by the lock table user (for example: Ob9.exe)
From
All_objects A,
V$locked_object B,
SYS. Gv_$session C
WHERE
a.object_id = b.object_id
and b.process = c.process
The order by 1,2 can also use the following command to kill the item in the current lock table:
Alter system kill session ' SID, Serial# '
-for example: Alter system kill session ' 57, 10325