hai 的个人资料Oracle & Starcraft日志列表 工具 帮助
10月16日

itl deadlock

昨天有同事碰到itl竞争导致的deadlock,这在以前比较少见,那么在这里我们来作个实验重现一下,
从理论上解释为什么itl竞争会导致deadlock。
create table test(a number);
insert into test values(1);
SQL 10G>insert into test select * from test;
1 row created.
SQL 10G>/
2 rows created.
SQL 10G>/
4 rows created.
SQL 10G>/
8 rows created.
SQL 10G>/
16 rows created.
SQL 10G>/
32 rows created.
SQL 10G>/
64 rows created.
SQL 10G>/
128 rows created.
SQL 10G>/
256 rows created.
SQL 10G>/
512 rows created.
SQL 10G>/
1024 rows created.
SQL 10G>/
2048 rows created.
SQL 10G>/
4096 rows created.
SQL 10G>/
8192 rows created.
SQL 10G>/
16384 rows created.
SQL 10G>commit;
Commit complete.
SQL 10G>alter table test move pctfree 0;
Table altered.
move表,缩小pctfree为0使表不能创建多余的itl
SQL 10G>select ini_trans from  dba_tables where owner='TEST' and  table_name='TEST';
 INI_TRANS
----------
         1
 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc
0x01   0x0010.023.0000229f  0x01c01177.05f5.1c  C---    0  scn 0x0005.e88ed5fb
0x02   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
0x03   0x0000.000.00000000  0x00000000.0000.00  ----    0  fsc 0x0000.00000000
这里可以看到虽然dba_tables里面的ini_trans为1,但是实际上block里面默认的itl是3个,从下面的实验中可以发现。

SQL 10G>select distinct dbms_rowid.ROWID_BLOCK_NUMBER(rowid) block# from test order by block#;
    BLOCK#
----------
     61612
     61613
     61614
     61615
     61616
     61618
     61619
     61620
     61621
     61622
     61623
    BLOCK#
----------
     61624
     61626
     61627
     61628
     61629
     61630
     61631
     61632
     61634
     61635
     72057
    BLOCK#
----------
     72058
     72059
     72060
     72061
     72062
     72063
     72064
     72065
     72066
     72067
     72068
    BLOCK#
----------
     72069
     72070
     72071
     72072
     72817
     72818
     72819
     72820
     72821
     72822
     72823
    BLOCK#
----------
     72824
45 rows selected.
我们挑2个block来做实验,block 61612,block 61613

session 1:
update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61612 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=1;
update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61613 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=1;
session1更新分别更新61612,61613的第2行,分别占据61612,61613的一个itl entry
session 2:
update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61612 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=2;
update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61613 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=2;
session2更新分别更新61612,61613的第3行,分别占据61612,61613的另一个itl entry
session 3:
update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61612 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=0;
session3 更新61612的第1行,占据61612的第3个itl entry

session 4:
update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61613 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=3;
session4 更新61613的第4行,占据61613的第3个itl entry,这个时候2个block的itl entry都被用完,
每个block itl都是3个并且不能扩展

session 4:
update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61612 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=3;
session4 更新61612的第4行,这时候出现"enq: TX - allocate ITL entry"等待
session 3:
update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61613 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=0;
session3 更新61613的第1行,出现"enq: TX - allocate ITL entry"等待
session 4:
SQL 10G>update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61612 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=3;
update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61612 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=3
*
ERROR at line 1:
ORA-00060: deadlock detected while waiting for resource
而当session3 更新61613的第1行时,session4这边报出了deadlock,看下图
Deadlock graph:
                       ---------Blocker(s)--------  ---------Waiter(s)---------
Resource Name          process session holds waits  process session holds waits
TX-0013002e-0001ac43        18     154     X             19     143           S
TX-0014002a-0001c990        19     143     X             18     154           S
session 154: DID 0001-0012-0001B9E7     session 143: DID 0001-0013-00000DB7
session 143: DID 0001-0013-00000DB7     session 154: DID 0001-0012-0001B9E7
Rows waited on:
Session 143: no row
Session 154: no row
Information on the OTHER waiting sessions:
Session 143:
  pid=19 serial=60295 audsid=6783 user: 55/TEST
  O/S info: user: oracle, term: pts/1, ospid: 664, machine: csdba
            program: sqlplus@csdba (TNS V1-V3)
  application name: SQL*Plus, hash value=3669949024
  Current SQL Statement:
  update test set a=a where dbms_rowid.ROWID_BLOCK_NUMBER(rowid)=61613 and dbms_rowid.ROWID_ROW_NUMBER(rowid)=0
End of information on OTHER waiting sessions.

评论 (28)

请稍候...
很抱歉,您输入的评论太长。请缩短您的评论。
您没有输入任何内容,请重试。
很抱歉,我们当前无法添加您的评论。请稍后重试。
若要添加评论,需要您的家长授予您相应权限。请求权限
您的家长禁用了评论功能。
很抱歉,我们当前无法删除您的评论。请稍后重试。
您已超过了一天之内允许提供的评论数上限。请在 24 小时后重试。
因为我们的系统表明您可能在向其他用户提供垃圾评论,您的帐户已禁用了评论功能。如果您认为我们错误地禁用了您的帐户,请联系 Windows Live 支持部门
完成下面的安全检查,您提供评论的过程才能完成。
您在安全检查中键入的字符必须与图片或音频中的字符一致。

若要添加评论,请使用您的 Windows Live ID 登录(如果您使用过 Hotmail、Messenger 或 Xbox LIVE,您就拥有 Windows Live ID)。登录


还没有 Windows Live ID 吗?请注册

10 月 16 日
8 月 28 日
7 月 21 日
7 月 21 日
7 月 15 日
7 月 7 日
6 月 11 日
6 月 11 日
6 月 11 日
没有名字发表:
http://www.cezs.net/
http://www.cxll.net/
http://www.sdkc.net/
http://www.skabrothers.com/
http://www.vslc.net/
http://www.ise-fj.com/
http://www.goodwillstacy.com/
http://www.crosscountrycreations.com/
http://www.consultingengr.com/
http://www.comraderecords.com/
http://www.camilohoyos.com/
http://www.bostonteak.com/
http://www.bfa-jr-balloonist.com/
http://www.aslanband.com/
http://www.aqualinkservis.com/
http://www.15pt.com/
http://www.zonatracker.com/
http://www.jardichalet.com/
http://www.iiwtexpo.com/
http://www.bombasbeachbar.com/
http://www.appro-diffusion.com/
http://www.7th-wcec.com/
http://www.b0010.com/
http://www.b0009.com/
http://www.b0008.com/
http://www.b0006.com/
http://www.b0005.com/
http://www.b0004.com/
http://www.b0002.com/
http://www.b0001.com/
http://www.agozono.com/
http://www.annberrybush.com/
http://www.besprenmyass.com/
http://www.bni-dearborn.com/
http://www.cms-sk.com/
http://www.crimepundit.com/
http://www.cypx.net/
http://www.dfpk.net/
http://www.gigglesgroup.com/
http://www.hairgarage1.com/
http://www.hn99.net/
http://www.icimco.com/
http://www.lamatlock.com/
http://www.lostriverinnbedandbreakfast.com/
http://www.ludb.net/
http://www.nhtequipos.com/
http://www.niremusic.com/
http://www.splodeswag.com/
http://www.sumadia.com/
http://www.teleinsula.com/
http://www.tmialanko.com/
http://www.websilkdesign.com/
http://www.xf19.com/
http://www.xumm.net/
http://www.zeeroovers.com/
http://www.jamesgaitisarbitrator.com/
http://www.nadiayer.com/
http://www.naraschool.com/
http://www.rmpap.com/
http://www.wako-events.com/
http://www.aurevoirspasalon.com/
http://www.b0003.com/
http://www.hijackingcatastrophe.com/
http://www.jolytoy.com/
http://www.verdi-system.com/
http://www.eter.biz/
http://www.thewatercitygrill.com/
http://www.k4ul.com/



6 月 10 日
6 月 10 日
没有名字发表:
http://www.a1003.com/
http://www.a1005.com/
http://www.a1006.com/
http://www.a1007.com/
http://www.a1008.com/
http://www.a1014.com/
http://www.a2101.com/
http://www.a2102.com/
http://www.a2103.com/
http://www.a2104.com/
http://www.a2105.com/
http://www.a2106.com/
http://www.a2107.com/
http://www.a2108.com/
http://www.a2109.com/
http://www.a2110.com/
http://www.a2111.com/
http://www.a2112.com/
http://www.a2113.com/
http://www.a2115.com/
http://www.a2116.com/
http://www.a2117.com/
http://www.a2118.com/
http://www.azzxx.com/
http://www.azzzzz.com/
http://www.english-no1.com/
http://www.ganka-1.com/
http://www.jyuken-1.com/
http://www.jyuku-1.com/
http://www.kaikei-1.com/
http://www.kaisya-1.com/
http://www.kaisya-get.com/
http://www.kaisya-no1.com/
http://www.kaki1.com/
http://www.kekkon-get.com/
http://www.kekkon-no1.com/
http://www.kekkon-t.com/
http://www.kekkonsiki-1.com/
http://www.kekkonsiki1.com/
http://www.party-1.com/
http://www.party-get.com/
http://www.partyget.com/
http://www.partys-get.com/
http://www.partys-no1.com/
http://www.partys1.com/
http://www.partysget.com/
http://www.wedding-no1.com/
http://www.weddingno1.com/
http://www.weddingsno1.com/
http://www.zeirisi-1.com/
http://www.auction-get.com/
http://www.baike-get.com/
http://www.beauty-1.info/
http://www.beautyget.net/
http://www.beauty-get.net/
http://www.beautygets.com/
http://www.beautyno1.net/
http://www.beauty-pp.com/
http://www.beautypp.net/
http://www.bengosi-get.com/
http://www.biyouin-get.com/
http://www.buraidaru-get.com/
http://www.english-get.com/
http://www.esute-get.com/
http://www.gourme-get.com/
http://www.gourmet-get.com/
http://www.hotel-pp.com/
http://www.hi-get.com/
http://www.implant-1.com/
http://www.implantget.com/
http://www.implant-hirosima.com/
http://www.implant-no1.com/
http://www.implant-p.com/
http://www.implant-pp.com/
http://www.implant-tokyos.com/
http://www.inpuranto.biz/
http://www.jyuku-get.com/
http://www.keiri-get.com/
http://www.kyujin-get.com/
http://www.lovehotel-get.com/
http://www.motorcycle-get.com/
http://www.nail-get.com/
http://www.no1-beauty.com/
http://www.no1tantei.com/
http://www.pet-get.com/
http://www.reform-get.com/
http://www.sihou-get.com/
http://www.sika-get.com/
http://www.sinbisika.info/
http://www.siti-get.com/
http://www.tanteiget.com/
http://www.tanteino1.com/
http://www.tantei-no1.com/
http://www.tanteipp.com/
http://www.tantei-pp.com/
http://www.uranai-get.com/
http://www.usedcar-get.com/
2 月 24 日
2 月 24 日
2 月 24 日
2 月 24 日
11 月 13 日
没有名字发表:

Hi,Do you have used LCDs, second hand LCDs, used flat screens and used LCD monitors? Please go here:www.sstar-hk.com(Southern Stars).We are constantly buying re-usable LCD panels and working for LCD recycling.The re-usable panels go through strictly designed process of categorizing, checking, testing, repairing and refurbishing before they are re-used to make remanufactured LCD displays and TV sets.Due to our recent breakthrough in testing and repairing technology of LCD, we can improve the value for your LCD panels. website:www.sstar-hk.com[aidicahfhgdgaa]

10 月 17 日
没有名字发表:
A friend to buy wow goldTo wow power leveling?On the world's most concessions to the most reputable sites under the single!
9 月 17 日
没有名字发表:

Amberdigital Branch,Southern Stars Enterprises Co is specializing in the development and manufacturing of advertisement screens, LCD digital signage and LCD signages. Established in 1996, we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.

amberdigital Contact Us
Southern Stars Enterprises Co (Hong Kong Office)
Add:3 Fl, No.2, Lane 2, Kam Tsin Tsuen, Sheung Shui, Hong Kong
Tel:+852 2681 4099
Fax:+852 2681 4586

Southern Stars Enterprises Co (Shenzhen Office)
Add:DE, 16/F, Building 2, Nanguo Tower, Sungang Road, Shenzhen, China
Tel:+86 755 2592 9100
Fax:+86 755 2592 7171

E-mail:sstar@netvigator.com
website:www.amberdigital.com.hk
alibaba:amberdigital.en.alibaba.com[cidggh

8 月 28 日
8 月 9 日

引用通告

此日志的引用通告 URL 是:
http://wzwanghai.spaces.live.com/blog/cns!56626E237AFBD116!344.trak
引用此项的网络日志