Question : Oracle Session Locks

There are multiple delete sessions that I've run on the server and most of them lock on similar tables. From oracle's session browser I cannot find out the exact cause. I get the following statement repeated multiple times.

Can anyone help please.

DELETE FROM   SIEBEL.S_TBL
      WHERE   ROW_ID = :B1

Answer : Oracle Session Locks

to see the cursors and values used, check the various v$sqlxxxxxx views, in particular v$sql_bind_data

http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2115.htm#i1417482


to check who is blocking whom,  try this query.

It will produce a visual tree of sessions blocking each other.
The top-left-most session is the root blocking other sessions below and indented from it
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
WITH lock_holders AS
     (
         SELECT w.session_id w_sess_id, h.session_id h_sess_id,
                w.lock_type w_lock_type, h.mode_held h_mode_held,
                w.mode_requested w_mode_requested, w.lock_id1 w_lock_id1,
                w.lock_id2 w_lock_id2
           FROM (SELECT session_id, lock_type, mode_requested, lock_id1,
                        lock_id2
                   FROM dba_lock
                  WHERE mode_requested != 'None') w,
                (SELECT session_id, mode_held,lock_type,lock_id1,lock_id2
                   FROM dba_lock
                  WHERE blocking_others = 'Blocking'
                    AND mode_held != 'None'
                    AND mode_held != 'Null') h
          WHERE w.lock_type = h.lock_type
            AND w.lock_id1 = h.lock_id1
            AND w.lock_id2 = h.lock_id2)
SELECT     LPAD(' ', 3 *(LEVEL - 1)) || w_sess_id waiting_session,
           w_lock_type, w_mode_requested, h_mode_held, w_lock_id1, w_lock_id2
      FROM (SELECT *
              FROM lock_holders
            UNION ALL
            (SELECT h_sess_id, NULL, 'None', NULL, NULL, NULL, NULL
               FROM lock_holders
             MINUS
             SELECT w_sess_id, NULL, 'None', NULL, NULL, NULL, NULL
               FROM lock_holders))
CONNECT BY PRIOR w_sess_id = h_sess_id
START WITH h_sess_id IS NULL
Random Solutions  
 
programming4us programming4us