How to query locked tables in Oracle?
To query a locked table, you can use the following SQL statement:
SELECT
c.owner,
c.object_name,
c.object_type,
b.session_id,
b.locked_mode,
b.os_user_name,
b.machine,
b.process,
b.program
FROM
v$locked_object a,
dba_objects c,
v$session b
WHERE
a.object_id = c.object_id
AND a.session_id = b.sid;
This SQL statement will retrieve information about all locked tables, including the table owner, table name, table type, locked session ID, lock mode, operating system username, machine name, process ID, and program name.