Saturday, November 18, 2006

Find Locking Objects in Oracle

This article will be helpful to identify the objects which are locked, blocking locks and the exactly which row is locked in Oracle DB.

In order to execute these query you should have the select grant on the following Oracle System Tables
* v$session
* v$Locked_object
* v$lock


/* To Identify the Locking*/
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 bWHERE a.object_id = b.object_id
ORDER BY 1

/* To Identify The Bolking Locks*/
select s1.username '@' s1.machine ' ( SID=' s1.sid ' ) is blocking ' s2.username '@' s2.machine ' ( SID=' s2.sid ' ) ' AS blocking_status
from v$lock l1, v$session s1, v$lock l2, v$session s2
where s1.sid=l1.sid
and s2.sid=l2.sid
and l1.BLOCK=1
and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2 ;


/* To Identify Which Row is Locked*/
/* Replace the Tag <> with the appropriate SID*/
select row_wait_obj#, row_wait_file#, row_wait_block#, row_wait_row# from v$session where sid= <>;

/* To Identify Which Row is Locked*/
/* Replace the Tag <> with the appropriate SID*/
select do.object_name,
row_wait_obj#, row_wait_file#, row_wait_block#, row_wait_row#,
dbms_rowid.rowid_create ( 1, ROW_WAIT_OBJ#, ROW_WAIT_FILE#, ROW_WAIT_BLOCK#, ROW_WAIT_ROW# )
from v$session s,
user_objects do
where
s.ROW_WAIT_OBJ# = do.OBJECT_ID
and SID=<>;

Friday, November 17, 2006

Transparent Background For User Controls on C#

Inorder to set the Transparent property to your user control,

Please add the following code in the Construtor of your code

// Setting the Control's Style Property
this.SetStyle(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor,true);

//Set the Backcolor of the Property to Transparent
this.Backcolor=System.Drawing.Color.Transparent;