Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Locks

Re: Locks

From: Glen Mitchell <glen.mitchell_at_peace.com>
Date: Thu, 21 Jun 2001 14:13:58 -0700
Message-ID: <F001.00332C21.20010621140113@fatcity.com>

This one showed up on the list a couple of weeks ago.  It has heaps of good diagnostic info.
set linesize 132 pagesize 66
break on Kill on username on terminal
column Kill heading 'Kill String' format a13 column res heading 'Resource Type' format 999 column id1 format 9999990
column id2 format 9999990
column lmode heading 'Lock Held' format a20 column request heading 'Lock Requested' format a20 column serial# format 99999
column username format a10 heading "Username" column terminal heading Term format a6
column tab format a35 heading "Table Name" column owner format a9
column Address format a18
select nvl(S.USERNAME,'Internal') username, nvl(S.TERMINAL,'None') terminal,
L.SID||','||S.SERIAL# Kill,
U1.NAME||'.'||substr(T1.NAME,1,20) tab,
decode(L.LMODE,1,'No Lock',

2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) lmode,

decode(L.REQUEST,1,'No Lock',
2,'Row Share',
3,'Row Exclusive',
4,'Share',
5,'Share Row Exclusive',
6,'Exclusive',null) request

from V$LOCK L,
V$SESSION S,
SYS.USER$ U1,
SYS.OBJ$ T1
where L.SID = S.SID
and T1.OBJ# = decode(L.ID2,0,L.ID1,L.ID2) and U1.USER# = T1.OWNER#
and S.TYPE != 'BACKGROUND'
order by 1,2,5
/
 
 

Ravindra Basavaraja wrote:
Does anyone have any script that will help me find out the locks that are
held in the database.
We are facing a problem related to lock.One of the transaction is holding a
lock on a table and
there is another transaction wanting a lock on that table but waits for long
time .Is there
any lock timeout parameter that can be set on the database. Thanks
Ravindra
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Ravindra Basavaraja

  INET: ravindra_at_sentica.com
Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051 San Diego, California        -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from).  You may also send the HELP command for other information (like subscribing). --  Glen Mitchell                   NZ Phone: +64 9 3730400 Energy Research Lab             URL: http://www.peace.com Peace Software                  Email: glen.mitchell_at_peace.com
 
Received on Thu Jun 21 2001 - 16:13:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US