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

SURACHARTOPUN'SBLOG

T H I S P A G E CO NT A I NS MY EX P ER I ENCES A ND MY T H O U G H T S A B O U T O R A CLE A ND ET C. . .
A B O U T I T . P ER H A P S W I T H A NO T H ER W A Y I N MY LI FE.

ViewSurachartOpun'sprofile
T U ES DA Y , J A NU A R Y 22, 2008

(surachartatgmaildotcom)

AnyIdeaAbout"INITRANS"
Whatis"INITRANS"?
Specifytheinitialnumberofconcurrenttransactionentriesallocatedwithin

S EAR CH T H I S B LO G

Search

eachdatablockallocatedtothedatabaseobject.Thisvaluecanrangefrom1
to255anddefaultsto1,withthefollowingexceptions:(on10g
MAX_TRANS'signored)
FEED ME!

*ThedefaultINITRANSvalueforaclusteris2orthedefaultINITRANS
valueofthetablespaceinwhichtheclusterresides,whicheverisgreater.

Posts
Comments

*Thedefaultvalueforanindexis2.
Ingeneral,youshouldnotchangetheINITRANSvaluefromitsdefault.
Eachtransactionthatupdatesablockrequiresatransactionentryinthe

B LO G AR CH I VES

BlogArchives

block.Thesizeofatransactionentrydependsonyouroperatingsystem.
Thisparameterensuresthataminimumnumberofconcurrenttransactions
canupdatetheblockandhelpsavoidtheoverheadofdynamicallyallocating
atransactionentry.

oreilly.comYourtechebook
superstore

Ifyouhaveglobalindexes,aglobalindexsegmentandglobalindexblocks
aresharedbyserverprocessesofthesameparallelDMLstatement.Evenif
theoperationsarenotperformedagainstthesamerow,theserverprocesses
cansharethesameindexblocks.Eachservertransactionneedsone
transactionentryintheindexblockheaderbeforeitcanmakechangestoa
block.
Therefore,intheCREATEINDEXorALTERINDEXstatements,
youshouldsetINITRANS,theinitialnumberoftransactionsallocated
withineachdatablock,toalargevalue,suchasthemaximumDOPagainst
thisindex
LI NK S

BLOCKSIZEandINITRANS:

www.pythian.com

=========================

asktom.oracle.com

EachITLentryintheblocktransactionvariableheadertakes24bytes.

forums.oracle.com

Thoughablockcanhaveamaximumof255differentITLs,theITLs

oracleforthai

allocationislimitedbyblocksize.Thedatabaseblocksizeplaysan

it.toolbox.com

importantrolewhenallocatingthenumberofinitalITLsfortheblock.The

mix.oracle.com

ruleis"thetotalsizeallocatedforinitialITLsSHOULDbeLESS
THAN50%ofthedatabaseblocksize".
ie:sizeof(INITIALITLs)<(50%oftheDATABASEBLOCKSIZE
)

morganslibrary.org
oraclecommunity.net
oracleracsig.org
orafaq.com
oss.oracle.com

ExaminingITLallocation(abriefexperiment)

otn.oracle.com

==========================

support.oracle.com
tahiti.oracle.com

STEP1:CreateatablewithINITRANS10.
SQL>CREATETABLETEST(INUMBER)INITRANS10
STEP2:Insert1recordfortestingpurpose.Ablockdumpcanbetakenlater.
SQL>INSERTINTOTESTVALUES(10)
SQL>COMMIT
Step3:Findouttheblocknumberandthefileidfordumpingtheblock:
SQL>selectdbms_rowid.rowid_relative_fno(rowid),
dbms_rowid.rowid_block_number(rowid)fromtest
Step4:Dumptheblock:
SQL>ALTERSYSTEMDUMPDATAFILExBLOCKy
Step5:OpenthedumptracefilelocatedinUSER_DUMP_DESTdirectory
andcheckthefollowing:
Blockheaderdump:0x0040ad12
ObjectidonBlock?Y
seg/obj:0x5881csc:0x5dc.33121987itc:10flg:Otyp:1DATA
fsl:0fnx:0x0ver:0x01
ItlXidUbaFlagLckScn/Fsc
0x01xid:0x0003.05b.0000009buba:0x008005f3.005e.42U1fsc
0x0000.33121989
0x02xid:0x0000.000.00000000uba:0x00000000.0000.000fsc
0x0000.00000000
0x03xid:0x0000.000.00000000uba:0x00000000.0000.000fsc
0x0000.00000000
0x04xid:0x0000.000.00000000uba:0x00000000.0000.000fsc
0x0000.00000000
0x05xid:0x0000.000.00000000uba:0x00000000.0000.000fsc
0x0000.00000000
0x06xid:0x0000.000.00000000uba:0x00000000.0000.000fsc

0x0000.00000000
0x07xid:0x0000.000.00000000uba:0x00000000.0000.000fsc
0x0000.00000000
0x08xid:0x0000.000.00000000uba:0x00000000.0000.000fsc
0x0000.00000000
0x09xid:0x0000.000.00000000uba:0x00000000.0000.000fsc
0x0000.00000000
0x0axid:0x0000.000.00000000uba:0x00000000.0000.000fsc
0x0000.00000000
Example:
SQL>CREATETABLETEST(INUMBER)INITRANS10
Tablecreated.
SQL>INSERTINTOTESTVALUES(10)
1rowcreated.
SQL>commit
Commitcomplete.
SQL>selectdbms_rowid.rowid_relative_fno(rowid),
dbms_rowid.rowid_block_number(rowid)fromtest
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID)
DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)

436477
SQL>ALTERSYSTEMDUMPDATAFILE4block36477
Systemaltered.
Checktracefile:
Blockheaderdump:0x01008e7d
ObjectidonBlock?Y
seg/obj:0x18feccsc:0x00.278431editc:10flg:Etyp:1DATA
brn:0bdba:0x1008e79ver:0x01opc:0
inc:0exflg:0
ItlXidUbaFlagLckScn/Fsc
0x010x0008.019.0017e02b0x01800ce1.17d9.08U1fsc
0x0000.278431ef
0x020x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x030x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x040x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x050x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000

0x060x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x070x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x080x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x090x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x0a0x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
TheabovedumpconfirmsthattheITLallocationworkedasspecified.
HoweverthismaynotbethecaseforallthevalidvaluesforINITRANS.
Assumingthatyourdatabasehas2kblocksize(db_block_size=2048),if
yousetINITRANSto45,only41ITLswillbefoundinthedumpbecauseof
theconsiderationoftheblocksize.Sofora2kblocksize,anyvaluegreater
than41forINITRANSwouldresultonlyinallocating41ITLentriesinthe
blockheader.
Likewise,ifyouhavea4kblocksize,themaximumnumberofinitalITL
entriesareonly83.Anyvalueoverandabove83forINITRANSareignored.
BLOCKSIZENOOFITLsallocatedinblockheader
=============================================
204841
409683
8192169
AsImentionedbefore,notmorethan50%oftheblockisutilizedforITLs.
Fora2kblocksizeddatabase,themaximumITLsduringintialallocationis
41.EachITLtakes24bytesofspaceintheheader.So
For2kBlock:41*24=984bytes.Thisis48%ofthetotalblocksize.
For4kblock:83*24=1992bytes.
For8kblock:169*24=4056bytes.(Same48%)
Followtheabove5stepstochecktheITLallocationfordifferent
blocksizes.
======================================================
============================
WecanmodifyINITRANSattributebyuseALTER
EXAMPLE

SQL>ALTERTABLETABLE_NAMEINITRANS10
Example:Teston8k...initrans=255
SQL>CREATETABLETEST2(INUMBER)INITRANS255
Tablecreated.
SQL>INSERTINTOTEST2VALUES(10)
1rowcreated.
SQL>commit
Commitcomplete.
SQL>selectdbms_rowid.rowid_relative_fno(rowid),
dbms_rowid.rowid_block_number(rowid)fromtest2
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID)
DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)

436485
SQL>ALTERSYSTEMDUMPDATAFILE4block36485
Systemaltered.
Checktracefile:
Blockheaderdump:0x01008e85
ObjectidonBlock?Y
seg/obj:0x18fedcsc:0x00.2784367fitc:169flg:Etyp:1DATA
brn:0bdba:0x1008e81ver:0x01opc:0
inc:0exflg:0
ItlXidUbaFlagLckScn/Fsc
0x010x0004.008.0011e01c0x01800c72.154d.05U1fsc
0x0000.27843681
0x020x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
.
.
.
0xa50x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0xa60x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0xa70x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0xa80x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000

So,useshellcommandtohelp
$grepfscoradb1_ora_15394.trc|wcl

169
So,8kblock:169*24=4056bytes.(Same48%)...not255

Youshouldknowbeforemodify=>
CautionsonAlteringTablesPhysicalAttributesThevaluesyouspecifyin
thisclauseaffectthetableasfollows:
*Foranonpartitionedtable,thevaluesyouspecifyoverrideanyvalues
specifiedforthetableatcreatetime.
*Forarange,list,orhashpartitionedtable,thevaluesyouspecifyare
thedefaultvaluesforthetableandtheactualvaluesforeveryexisting
partition,overridinganyvaluesalreadysetforthepartitions.Tochange
defaulttableattributeswithoutoverridingexistingpartitionvalues,use
themodify_table_default_attrsclause.
*Foracompositepartitionedtable,thevaluesyouspecifyarethedefault
valuesforthetableandallpartitionsofthetableandtheactualvaluesfor
allsubpartitionsofthetable,overridinganyvaluesalreadysetforthe
subpartitions.Tochangedefaultpartitionattributeswithoutoverriding
existingsubpartitionvalues,usethemodify_table_default_attrsclause
withtheFORPARTITIONclause.


S U R A CH A R T O P U N

10: 17 P M



: 10G , 11G , I NDEX , I NI T R A NS , T A B LE

6CO MMENTS:
Anonymoussaid...
Hi,
Goodinfo,thecommandinstep4todumptheblockwillbeasfolls
altersystemdumpdatafile4block421.Thedatafilenoandtheblock
nowillchangeasperthequeryinstep3.
2:1 2P M
farhansaid...
Veryinformativearticle.Therewasacorrectioninstep4whichisas
follows

altersystemdumpdatafile4block421
Thedatafilenoandblocknowillchangeasperthequeryinstep3
2:1 6P M
Surachartsaid...
Thankyou...aboutStep3+4
SQL>CREATETABLETEST(INUMBER)INITRANS10
Tablecreated.
SQL>INSERTINTOTESTVALUES(10)
1rowcreated.
SQL>commit
Commitcomplete.
SQL>selectdbms_rowid.rowid_relative_fno(rowid),
dbms_rowid.rowid_block_number(rowid)fromtest
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID)
DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)

436477
SQL>ALTERSYSTEMDUMPDATAFILE4block36477
Systemaltered.

Blockheaderdump:0x01008e7d
ObjectidonBlock?Y
seg/obj:0x18feccsc:0x00.278431editc:10flg:Etyp:1DATA
brn:0bdba:0x1008e79ver:0x01opc:0
inc:0exflg:0
ItlXidUbaFlagLckScn/Fsc
0x010x0008.019.0017e02b0x01800ce1.17d9.08U1fsc
0x0000.278431ef
0x020x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000

0x030x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x040x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x050x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x060x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x070x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x080x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x090x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
0x0a0x0000.000.000000000x00000000.0000.000fsc
0x0000.00000000
2:30 P M
farhansaid...
Hiagain,
Anothersimplewaytogetthefilename,theblockidandthenumber
ofblocksallocated.
Belowisthequery
selectfile_id,block_id,blocks
fromdba_extents
whereowner='TEST'
2:36P M
farhansaid...
TheabovequerywastakenfromOracle10gtipsandtunningbookby
Richnemeic.
2:40 P M
Surachartsaid...
thankyoufarhan....
Goodideatousedba_extentsview...Butgetblockheader)
selectfile_id,block_id,blocksfromdba_extentswhereowner=
'OWNER'andSEGMENT_NAME='TEST'

FILE_IDBLOCK_IDBLOCKS

4364738
Igetblockheader)
ButIneedtoknowblockof"TESTVALUES(10)",actuallyit=
36477
SQL>selectdbms_rowid.rowid_relative_fno(rowid),
dbms_rowid.rowid_block_number(rowid)fromtest
DBMS_ROWID.ROWID_RELATIVE_FNO(ROWID)
DBMS_ROWID.ROWID_BLOCK_NUMBER(ROWID)

436477
3:0 7 P M
PostaComment




CreateaLink
NewerPost

Home

Subscribeto:PostComments(Atom)

OlderPost