This query helps the DBA and application developer to identify the locked objects. This query gives you the detail for locked object,owner of object and the hostname of the user who has acquired lock on object.
SELECT c.owner, c.object_name, c.object_type, b.SID, b.serial#, b.status,b.osuser, b.machine
FROM v$locked_object a, v$session b, dba_objects c
WHERE b.SID = a.session_id AND a.object_id = c.object_id;
Example:
SELECT c.owner, c.object_name, c.object_type, b.SID, b.serial#, b.status,
b.osuser, b.machine
FROM v$locked_object a, v$session b, dba_objects c
WHERE b.SID = a.session_id AND a.object_id = c.object_id;
OWNER OBJECT_NAM OBJECT_TYPE SID SERIAL# STATUS OSUSER MACHINE
---------- ---------- ------------------- ---------- ---------- -------- --------------- ---------------
ASHISH T1 TABLE 148 10 INACTIVE oracle oracle10g.works
tation.com
Above example, shows table t1 is locked. User has occupied lock on oracle10g.workstation.com machine.
SELECT c.owner, c.object_name, c.object_type, b.SID, b.serial#, b.status,b.osuser, b.machine
FROM v$locked_object a, v$session b, dba_objects c
WHERE b.SID = a.session_id AND a.object_id = c.object_id;
Example:
SELECT c.owner, c.object_name, c.object_type, b.SID, b.serial#, b.status,
b.osuser, b.machine
FROM v$locked_object a, v$session b, dba_objects c
WHERE b.SID = a.session_id AND a.object_id = c.object_id;
OWNER OBJECT_NAM OBJECT_TYPE SID SERIAL# STATUS OSUSER MACHINE
---------- ---------- ------------------- ---------- ---------- -------- --------------- ---------------
ASHISH T1 TABLE 148 10 INACTIVE oracle oracle10g.works
tation.com
Above example, shows table t1 is locked. User has occupied lock on oracle10g.workstation.com machine.
No comments:
Post a Comment