This document provides SQL queries to view information about locked objects in the database, including the session ID, username, object owner, name, type, and locked mode. The first query selects this data from the v$locked_object and dba_objects views. The second query enhances the output with additional columns like status and last DDL time by joining with the v$session view.
This document provides SQL queries to view information about locked objects in the database, including the session ID, username, object owner, name, type, and locked mode. The first query selects this data from the v$locked_object and dba_objects views. The second query enhances the output with additional columns like status and last DDL time by joining with the v$session view.
This document provides SQL queries to view information about locked objects in the database, including the session ID, username, object owner, name, type, and locked mode. The first query selects this data from the v$locked_object and dba_objects views. The second query enhances the output with additional columns like status and last DDL time by joining with the v$session view.
column object_name format a37 column object_type format a37 select a.session_id,a.oracle_username, a.os_user_name, b.owner "OBJECT OWNER", b.object_name,b.object_type,a.locked_mode from (select object_id, SESSION_ID, ORACLE_USERNAME, OS_USER_NAME, LOCKED_MODE from v$locked_object) a, (select object_id, owner, object_name,object_type from dba_objects) b where a.object_id=b.object_id;
set linesize 150;
set head on; col sid_serial form a13 col ora_user for a15; col object_name for a35; col object_type for a10; col lock_mode for a15; col last_ddl for a8; col status for a10;
break on sid_serial;
SELECT l.session_id||','||v.serial# sid_serial,
l.ORACLE_USERNAME ora_user, o.object_name, o.object_type, DECODE(l.locked_mode, 0, 'None', 1, 'Null', 2, 'Row-S (SS)', 3, 'Row-X (SX)', 4, 'Share', 5, 'S/Row-X (SSX)', 6, 'Exclusive', TO_CHAR(l.locked_mode) ) lock_mode, o.status, to_char(o.last_ddl_time,'dd.mm.yy') last_ddl FROM dba_objects o, gv$locked_object l, v$session v WHERE o.object_id = l.object_id and l.SESSION_ID=v.sid order by 2,3;