Want to post your scripts here in this blog ? Email it to snojha@gmail.com. You will be rewarded for your scripts if selected by our experts.

Wednesday, July 11, 2007

locked_objects.sql

-- -----------------------------------------------------------------------------------
-- File Name : locked_objects.sql
-- Author : Sachchida Ojha
-- Description : Lists all locked objects.
-- Requirements : Access to the V$ views.
-- Call Syntax : @locked_objects
-- Last Modified: 04/28/2005
-- -----------------------------------------------------------------------------------
SET LINESIZE 500
SET PAGESIZE 1000
SET VERIFY OFF

SELECT a.object_name,
a.owner object_owner,
Decode(b.locked_mode, 0, 'None',
1, 'Null (NULL)',
2, 'Row-S (SS)',
3, 'Row-X (SX)',
4, 'Share (S)',
5, 'S/Row-X (SSX)',
6, 'Exclusive (X)',
b.locked_mode) locked_mode,
b.session_id sid,
b.oracle_username,
b.os_user_name
FROM all_objects a,
v$locked_object b
WHERE a.object_id = b.object_id
ORDER BY 1;

SET PAGESIZE 14
SET VERIFY ON

No comments: