Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: locks?
--------------AA9FB475BDD54C224320E312 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit
try this below select st .....
select s.sid, s.serial#, decode(s.process, null,
decode(substr(p.username,1,1), '?', upper(s.osuser), p.username), decode( p.username, 'ORACUSR ', upper(s.osuser), s.process)) process,
nvl(s.username, 'SYS ('||substr(p.username,1,4)||')') username, decode(s.terminal, null, rtrim(p.terminal, chr(0)),
upper(s.terminal)) terminal, decode(l.type,
'TM', 'DML/DATA ENQ', 'TX', 'TRANSAC ENQ',
'UL', 'PLS USR LOCK', -- Short locks
'BL', 'BUF HASH TBL', 'CF', 'CONTROL FILE',
'CI', 'CROSS INST F', 'DF', 'DATA FILE ',
'CU', 'CURSOR BIND ',
'DL', 'DIRECT LOAD ', 'DM', 'MOUNT/STRTUP',
'DR', 'RECO LOCK ', 'DX', 'DISTRIB TRAN',
'FS', 'FILE SET ', 'IN', 'INSTANCE NUM',
'FI', 'SGA OPN FILE',
'IR', 'INSTCE RECVR', 'IS', 'GET STATE ',
'IV', 'LIBCACHE INV', 'KK', 'LOG SW KICK ',
'LS', 'LOG SWITCH ',
'MM', 'MOUNT DEF ', 'MR', 'MEDIA RECVRY',
'PF', 'PWFILE ENQ ', 'PR', 'PROCESS STRT',
'RT', 'REDO THREAD ', 'SC', 'SCN ENQ ',
'RW', 'ROW WAIT ',
'SM', 'SMON LOCK ', 'SN', 'SEQNO INSTCE',
'SQ', 'SEQNO ENQ ', 'ST', 'SPACE TRANSC',
'SV', 'SEQNO VALUE ', 'TA', 'GENERIC ENQ ',
'TD', 'DLL ENQ ', 'TE', 'EXTEND SEG ',
'TS', 'TEMP SEGMENT', 'TT', 'TEMP TABLE ',
'UN', 'USER NAME ', 'WL', 'WRITE REDO ',
'TYPE='||l.type) type,
decode(l.lmode, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX', 4, 'S', 5, 'RSX', 6, 'X', to_char(l.lmode) ) lmode, decode(l.request, 0, 'NONE', 1, 'NULL', 2, 'RS', 3, 'RX', 4, 'S', 5, 'RSX', 6, 'X', to_char(l.request) ) lrequest, decode(l.type, 'MR', decode(u.name, null, 'DICTIONARY OBJECT', u.name||'.'||o.name),
'TD', u.name||'.'||o.name,
'TM', u.name||'.'||o.name,
'RW', 'FILE#='||substr(l.id1,1,3)||
' BLOCK#='||substr(l.id1,4,5)||' ROW='||l.id2,
'TX', 'RS+SLOT#'||l.id1||' WRP#'||l.id2,
'WL', 'REDO LOG FILE#='||l.id1,
'RT', 'THREAD='||l.id1,
'TS', decode(l.id2, 0, 'ENQUEUE',
'NEW BLOCK ALLOCATION'),
'ID1='||l.id1||' ID2='||l.id2) object
from sys.v_$lock l, sys.v_$session s, sys.obj$ o, sys.user$ u, sys.v_$process p
UNION ALL /*** LATCH HOLDERS ***/ select s.sid, s.serial#, s.process, s.username, s.terminal, 'LATCH', 'X', 'NONE', h.name||' ADDR='||rawtohex(laddr)from sys.v_$process p, sys.v_$session s, sys.v_$latchholder h where h.pid = p.pid and p.addr = s.paddr
UNION ALL /*** LATCH WAITERS ***/ select s.sid, s.serial#, s.process, s.username, s.terminal, 'LATCH', 'NONE', 'X', name||' LATCH='||p.latchwait from sys.v_$session s, sys.v_$process p, sys.v_$latch l where latchwait is not null and p.addr = s.paddrand p.latchwait = l.addr;
REgards
Veera Prasad
Swapna_P wrote:
> > > how can i find out the locks existing on a table and by whom? > rgds > swapna --------------AA9FB475BDD54C224320E312
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
try this below select st .....
<p>select s.sid, s.serial#, decode(s.process,
null,
<br> decode(substr(p.username,1,1), '?',
upper(s.osuser), p.username),
<br> decode( p.username,
'ORACUSR ', upper(s.osuser), s.process)) process,
<br> nvl(s.username, 'SYS ('||substr(p.username,1,4)||')')
username,
<br> decode(s.terminal, null, rtrim(p.terminal, chr(0)),
<br> upper(s.terminal)) terminal,
decode(l.type,
<br>
'TM', 'DML/DATA ENQ', 'TX', 'TRANSAC ENQ',
<br>
'UL', 'PLS USR LOCK',
-- Short locks
<br>
'BL', 'BUF HASH TBL', 'CF', 'CONTROL FILE',
<br>
'CI', 'CROSS INST F', 'DF', 'DATA FILE ',
<br>
'CU', 'CURSOR BIND ',
<br>
'DL', 'DIRECT LOAD ', 'DM', 'MOUNT/STRTUP',
<br> 'DR', 'RECO LOCK ', 'DX', 'DISTRIB TRAN', <br> 'FS', 'FILE SET ', 'IN', 'INSTANCE NUM', <br> 'FI', 'SGA OPN FILE',
<br> 'MM', 'MOUNT DEF ', 'MR', 'MEDIA RECVRY', <br> 'PF', 'PWFILE ENQ ', 'PR', 'PROCESS STRT', <br> 'RT', 'REDO THREAD ', 'SC', 'SCN ENQ ', <br> 'RW', 'ROW WAIT ',
<br> 'SM', 'SMON LOCK ', 'SN', 'SEQNO INSTCE', <br> 'SQ', 'SEQNO ENQ ', 'ST', 'SPACE TRANSC', <br> 'SV', 'SEQNO VALUE ', 'TA', 'GENERIC ENQ ', <br> 'TD', 'DLL ENQ ', 'TE', 'EXTEND SEG ',
<br> 'UN', 'USER NAME ', 'WL', 'WRITE REDO ', <br> 'TYPE='||l.type) type,
<br> and p.latchwait = l.addr; <p>REgards <br>Veera Prasad <br> <br> <p>Swapna_P wrote: <blockquote TYPE=CITE> <p><font face="Arial"><font color="#0000FF">how can i find out the locksexisting on a table and by whom?</font></font> Received on Thu Aug 03 2000 - 09:40:21 CDT