Вы находитесь на странице: 1из 3

DBNAME oracle10g enq:TX - contention

10genqueue TX4
1. enq:TX - row lock contention
2. enq:TX - index contention
3. enq:TX - ITL
4. enq:TX - contention
4transaction contention,
enq:TX - contentionsessionDMLsession
tablespace XXX read only,

session 1:
SQL> select sid from v$mystat where rownum <2;
SID
---------145
SQL> select table_name,tablespace_name from user_tables where table_name='INFO';
TABLE_NAME
TABLESPACE_NAME
------------------------------ -----------------------------INFO
USERS
SQL> update info set note=upper(note);
35
SQL> ()
session 2:
SQL> select sid from v$mystat where rownum <2;
SID
---------148
SQL> alter tablespace users read only;
session 1userssession 2
session 3:
SQL> select sid,event,p1,p2,p3 from v$session_wait where sid=148;
SID EVENT
P1
P2
P3
------- ------------------------------------------------------------------------- ---------- ---------148 enq: TX - contention
1415053316
65563
166

session 2enq: TX - contentionp1,p2,p3


SQL> SELECT name, parameter1, parameter2, parameter3 from v$event_name where
name = 'enq: TX - contention';
NAME
PARAMETER1
PARAMETER2
PARAMETER3
------------------------- -------------------- --------------------------------------enq: TX - contention
name|mode
usn<<16 | slot
sequence

parameter1enqueuenamemodeparameter216xidusn,16xidslot
v$transactionv$session,session 2
enqueuenamemode
SQL> SELECT sid, CHR (BITAND (p1,-16777216) / 16777215) ||
2
CHR (BITAND (p1, 16711680) / 65535) enq,
3
DECODE (BITAND (p1, 65535), 1, 'Null', 2, 'Sub-Share',
4
3, 'Sub-Exclusive', 4, 'Share', 5, 'Share/Sub-Exclusive',
5
6, 'Exclusive', 'Other') lock_mode
6 FROM v$session_wait WHERE sid = 148;
SID ENQ LOCK_MODE
------- ---- -------------------

148 TX Share
session 2
SQL> select sid from v$session where taddr in
2 (select b.addr from v$session_wait a,v$transaction b
3 where a.event='enq: TX - contention' and trunc(a.p2/power(2,16)) = xidusn
4 and (bitand(a.p2,to_number('ffff','xxxx'))+0) = xidslot and a.p3 = xidsqn);
SID
------145
session 2session 1
session 2
1session 2
SQL> select sid,id1,id2,trunc(id1/power(2,16))
rbs,bitand(id1,to_number('ffff','xxxx'))+0 slot,id2 seq,lmode,request,type from
v$lock where type = 'TX' and sid=&sid;
sid : 148

2: from v$lock where type = 'TX' and sid=&sid

2: from v$lock where type = 'TX' and sid=148


SID
ID1
ID2
RBS
SLOT
SEQ
LMODE
REQUEST TY
------- ---------- ---------- ---------- ---------- ---------- ------------------- -148
65563
166
1
27
166
0
4 TX
148

196646

168

38

168

0 TX
1484(share)
ID1ID2v$session_waitp2,p3
SQL> select sid,event,p1,p2,p3 from v$session_wait where sid=148;
SID EVENT
P1
P2
P3
------- ------------------------------------------------------------------------- ---------- ---------148 enq: TX - contention
1415053316
65563
166
2(ID1,ID2)
SQL> select sid,trunc(id1/power(2,16))
rbs,bitand(id1,to_number('ffff','xxxx'))+0 slot,id2 seq,lmode,request
from v$lock where type='TX' and id1=&id1 and id2=&id2;
id1 : 65563
id2 : 166

2: from v$lock where type='TX' and id1=&id1 and id2=&id2

2: from v$lock where type='TX' and id1=65563 and id2=166


SID
RBS
SLOT
SEQ
LMODE
REQUEST
------- ---------- ---------- ---------- ---------- ---------148
1
27
166
0
4
145
1
27
166
6
0
148share145exclusivesession 2
RAC
node 1session
SQL> conn test/test
Connected.
SQL> select sid from v$mystat where rownum < 2;
SID
---------617

SQL> insert into info values (1);


1 row created.

node 2session:
SQL> alter tablespace test read only;

node
SQL> select c.inst_id,c.sid
from gv$session_wait a,gv$transaction b, gv$session c
where a.event='enq: TX - contention'
and trunc(a.p2/power(2,16)) = b.xidusn
and (bitand(a.p2,to_number('ffff','xxxx'))+0) = b.xidslot
and a.p3 = b.xidsqn
and c.taddr = b.addr;
INST_ID
SID
---------- ---------1
617

Вам также может понравиться