国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術(shù)文章
文章詳情頁

oracle block 格式

瀏覽:41日期:2023-11-18 11:19:07
信息參考:; www.ixora.com.au 非凡感謝 overtime 大哥對我的無私的幫助和對我一直鼓勵支持我的網(wǎng)友這些資料是沒得到Oracle 支持的 所以不能保證信息的正確性 請謹(jǐn)慎使用 科技無限 隨便轉(zhuǎn)載 oracle 8.1.7 8k block; windows XP;create table t(n number);insert into t values(1);--- 從 dbms_rowid 中看出table t 的數(shù)據(jù)在datafile 4 的第3個 block 上alter system dump datafile 4 block 3;下面是 dump 的文件的信息還可以用下面的語句然后再用上面的 dump 語句看內(nèi)存中 block 的2進制存儲格式但這內(nèi)存中的2進制格式和datafile中block數(shù)據(jù)表示的順序會略有不同可能是內(nèi)存尋址的緣故吧ALTER SESSION SET EVENTS '10289 trace name context forever, level 1';ALTER SESSION SET EVENTS '10289 trace name context off';~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 下面的是 udump 目錄下面 dump 文件的信息-----------------------; 第一部分buffer tsn: 7 rdba: 0x01000003 (4/3)scn: 0x0000.000802a5 seq: 0x01 flg: 0x02 tail: 0x02a50601frmt: 0x02 chkval: 0x0000 type: 0x06=trans data--- buffer tsn: 數(shù)據(jù)文件對應(yīng)的 tablespace 的 number這只是dump文件中記錄的數(shù)據(jù)而已---;;;;block 中是沒有記錄 tablespace 的 number 的--- rdba:;4 bytes;datafile 中 block 的地址; 標(biāo)示的第幾個 block--- scn:;;6 bytes;system change number --- seq:;;1 byte;;A sequence number incremented for each change to a block at the same SCN---;;;;;A new SCN is allocated if the sequence number wraps. ---;;;;;同一個SCN影響這個block中的行數(shù)大于 254 行就會為這個事務(wù)分配一個新的SCN---;;;;;如下面的操作就可能引起同一個SCN但影響的同一個block 中的行超過254行---;;;;;'delete from table_name'; ---;;;;;影響的行數(shù)(最大254) 是用從 0x01 到 0xfe 表示的---;;;;;當(dāng)這個byte 的數(shù)據(jù)為 0xff 的時候標(biāo)志這個 block 壞調(diào)了---> ora-01578--- flg:;;1 byte;;1 = virgin block---;;2 = last change to the block was for a cleanout operation---;;4 = checksum value is set---;;8 = temporary data ---;;這是一個可以組合的值 也就是說有為 6 的時候是 2,4 兩種情況的組合--- tail:;4 bytes;這是記錄在 block 的最后面的 4 bytes 的數(shù)據(jù)--- dump文件中只是把他寫在了前面而已--- frmt:;1 byte;;oracle 8 以后看見的都是 0x02 --- chkval:; 2 bytes;在 init 文件中設(shè)置了 db_block_checksum=true 才有值--- type:;1 byte;;這個 block 的類型 這里主要看 0x06 這種 因為這種是用來存用戶數(shù)據(jù)的--- 其他的類型可以參考http://www.ixora.com.au/notes/cache_block_types.htm-----------------------; 第二部分Block header dump:; 0x01000003Object id on Block? Yseg/obj: 0x614a; csc: 0x00.802a3; itc: 1; flg: O; typ: 1 - DATA fsl: 0; fnx: 0x0 ver: 0x01 --- seg/obj: 4 bytes;這里是16進制的 對應(yīng) sys.obj$.obj# 數(shù)據(jù)字典的數(shù)據(jù)--- csc:;;6 bytes;The SCN at which the last full cleanout was performed on the block--- itc:;;1 byte;;下面的Itl事務(wù)條的個數(shù) 8.1.7的文檔上面說可以使用 INITRANS 在建表的時候---;;;;限制這個值的大小(max 255超過會報ORA-02207) 但要考慮block 的空間是否夠---;;;;表在8i中 INITRANS default為1 ,; 9.2.0中 INITRANS default為2---;;;;Yong Huang 說有些時候發(fā)生ORA-00060可以把表的 INITRANS 設(shè)置大點---;;;;ixora 上說當(dāng)block的空間不夠創(chuàng)建一個ITL的時候一樣可能引起ORA-00054--- flg:;;2 bytes;0 indicates that the block is on a freelist. Otherwise the flag is ----;;;;9i 的ASSM 的情況下這個值為 E---;;;;ixora 上說他占用 2 bytes 但我下面的試驗和他的結(jié)果有一定的出入---;;;;我觀察到的情況是 :---;;;;Object id on Block? Y---;;;;flg: O---;;;;ver: 0x01---;上面的3項是用同一個 byte 來表示的--- typ:;;1 byte;;1 為 table ; 2 為 index.; oracle進行查詢的時候是根據(jù) obj$表中的情況來---;;;;判定對象的類型的,不是根據(jù)這個typ。 也就是說假如有一個表但改變表中block---;;;;的這個標(biāo)志位,一樣可以查詢出數(shù)據(jù)來,但dump block 時會出錯,如下面的ora---;;;;ORA-00600: 內(nèi)部錯誤代碼,自變量: [4555], [0], [], [], [], [], [], []---;;;;錯誤中的 [0] 就是typ對應(yīng)的數(shù)據(jù)--- fsl:;;1 byte;;Index to the first slot on the ITL freelist.; ITL TX freelist slot--- fnx:;;4 bytes;自由列表中下一塊的地址 Null if this block is not on a freelist ---;;;;有數(shù)據(jù)例如: fnx: 0x1000029--- ver:;;1 byte;;format (version) 這個數(shù)據(jù)沒有看到相關(guān)的文檔介紹 從ixora上說是占用1byte---;;;;但我從下面的2進制文件中看到的有不同 下面有介紹--- unused:; 4 bytes;在這里還有4 bytes 的空閑的空間 但在上面的 dump 文件上是沒顯示出來的---;;;;;這個unused 的4 bytes是 ixora 上面的說法---;;9i 的 ASSM 的 ' fsl: 0; fnx: 0x0 ver: 0x01 '這一段數(shù)據(jù)的情況已經(jīng)改變了-----------------------; 第三部分ItlXid; Uba;;;Flag; Lck;;;;;Scn/Fsc0x01xid:; 0x0003.045.000000b4;uba: 0x0080170a.00c7.36; --U-;1; fsc 0x0000.000802a5--- 這是 oracle 用來記錄事務(wù)信息的部分; 這里顯示的只有一個ITL條 有多少個ITL條是可以動態(tài)增加的--- 只要 block 中的空間足夠; 可以定義初始化的 ITL 條的個數(shù) 用 INITRANS 這storage 參數(shù)--- 這里有多少個 ITL 可以從上面 '第二部分' 的 'itc:' 看出來--- 這部分牽扯 rollback segment 或 undo tablespace --- Itl itl 的序號--- xid:;;8 bytes;值可以用select XIDUSN, XIDSLOT,XIDSQN from v$transaction;查到---;;This is comprised of the rollback segment number (2 bytes), the slot number---;;in the transaction table of that rollback segment (2 bytes), and the number---;;of times use of that transaction table has wrapped (4 bytes).; --- Uba:;;8 bytes;The location of the undo for the most recent change to this block by this---;;transaction. This is comprised of the DBA of the rollback segment block (4---;;bytes), the sequence number (2 bytes), and the record number for the change---;;in that undo block (1 byte), plus 1 unused byte.; --- flag;;1 nibble---- = transaction is active, or committed pending cleanout---;;C--- = transaction has been committed and locks cleaned out---;;-B-- = this undo record contains the undo for this ITL entry---;;--U- = transaction committed (maybe long ago); SCN is an upper bound---;;---T = transaction was still active at block cleanout SCN--- Lck;;;3 nibbles; The number of row-level locks held in the block by this transaction.; --- Scn/Fsc; 6 bytes;If the transaction has been cleaned out, this is the commit SCN or an upper---;;bound thereof. Otherwise the leading two bytes contain the free space credit---;;for the transaction - that is, the number of bytes freed in the block by the---;;transaction --- 參考http://www.ixora.com.au/q+a/datablock.htm#end--------------------------; 第四部分data_block_dump===============tsiz: 0x1fb8hsiz: 0x14pbl: 0x02476c44bdba: 0x01000003flag=-----------ntab=1nrow=1frre=-1fsbo=0x14fseo=0x1fb2avsp=0x1f9btosp=0x1f9b0xe:pti[0];nrow=1;offs=00x12:pri[0];offs=0x1fb2---;;;;tsiz:;hsiz:pbl:bdba: 在數(shù)據(jù)文件都是沒有存儲的 --- tsiz:;;;;;除了上面的3部分和block尾部的4個字節(jié)剩下的空間 0x1fb8就是8120字節(jié); 8k的block: ---;;;8192-20(block head)-24(Transaction Header)-24(一個事務(wù)條)-4(block tail)=8120--- hsiz:;;;;;數(shù)據(jù)塊頭20個字節(jié)+數(shù)據(jù)塊尾4個字節(jié)=24字節(jié)(0x14)--- pbl: ptr to buffer holding the block 我是用的專用模式dump的datafile中的block出來---;;;在同一個session的dump文件中 dump 出來的block 的這個都是同一個值--- bdba:;;;;;和第一部分中的rdba 一個意思--- flag 1 byte;;N=pctfree hit(clusters), F=don't put on free list--- K=flushable cluster keys. 當(dāng)然還有別的標(biāo)記: A ...--- ntab 1 byte;;這block中有幾個table的數(shù)據(jù)cluster這個就可能大于1--- nrow 2 bytes;block 中有多少行數(shù)據(jù)--- frre 2 bytes;First free row index entry. -1=you have to add one.--- fsbo 2 bytes;Free Space Begin offset--- fseo 2 bytes;Free Space End offset--- avsp 2 bytes;Available space in the block;<pctfree and pctused? >--- tosp 2 bytes;Total available space when all TXs commit--- 0xe: nrow;2 bytes;block 中的這個table有多少行數(shù)據(jù)--- 0xe: offs;2 bytes;偏移量 用 cluster 的時候可以看出值-----------------------; 第五部分block_row_dump:tab 0, row 0, @0x1fb2tl: 6 fb: --H-FL-- lb: 0x1 cc: 1col; 0: [ 2]; c1 02end_of_block_dump--- tl:;;這條記錄中的長度 包括row head 的一般情況的 3 字節(jié)和表示數(shù)據(jù)長度的1字節(jié)和數(shù)據(jù)本身的長度--- fb:1 byteK = Cluster Key (Flags may change meaning if this is set to show HASH cluster) ---;;;;;C = Cluster table member ---;;;;;H = Head piece of row ---;;;;;D = Deleted row ---;;;;;F = First data piece ---;;;;;L = Last data piece ---;;;;;P = First column continues from previous piece ---;;;;;N = Last column continues in next piece--- lb:1 byte和上面第三部分的 ITL 的lck相對應(yīng); 表示這行是否被 lock 了--- cc:1 byte表示這行有幾列數(shù)據(jù)--- col; 0: [ 2] : 1 byte; 表示這行的這列的長度 --- c1 02 :;;;;;這就是table中的數(shù)據(jù) '1'; 可以通過下面的語句看 oracle真正使用的是---;;;;;那些16進制的數(shù)據(jù)來表示的用戶數(shù)據(jù) select dump(col_name,16) from table_name;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 下面的數(shù)據(jù)就是上面的 dump 文件對應(yīng)的2進制文件; 我依照 2 進制數(shù)據(jù)的順序解釋內(nèi)容------------------------; 下面的對應(yīng)上面dump 文件的第一部分Offset;;;0; 1; 2; 3; 4; 5; 6; 78; 9; A; B; C; D; E; F0000600006 02 00 00 03 00 00 01; A5 02 08 00 00 00 01 020000601000 00 00 00 --- 06;;;;:type: 0x06=trans data (對應(yīng)上面dump文件中的內(nèi)容)--- 02;;;;:frmt: 0x02--- 00 00;:filler; 應(yīng)該是 unused; 上面的dump文件中并沒有顯示這部分內(nèi)容--- 03 00 00 01;;;:rdba: 0x01000003 在同一個 tablespace 中是唯一的 當(dāng) datafile 中可能不唯一---;;;;;來看看他的規(guī)律 :連續(xù)建4個 datafile; 他們的第一block為---;;;;;0x 01 00 04 01---;;;;;0x 01 00 08 01---;;;;;0x 01 00 0c 01---;;;;;0x 01 00 00 02---;;;;;對應(yīng)的數(shù)據(jù)在是 0x01040001 , 0x01080001 , 0x010c0001 , 0x02000001---;;;;;這就可以看出一個 datafile 的最大的容量是 0x01040001~0x0107ffff 總共是---;;;;;4M(因為還有一個datafile head)個block 假如block 是8k 一個datafile就是 32G ---;;;;;這就是oracle 的文檔上面對 oracle 的 datafile (8k的時候)最大 32G 的原因---;;;;;同樣可以看出一個 tablespace 的datafile 可以從 0x0100 到 0xfffe 就是1023---;;;;;個 datafile 這也是 oracle 的文檔上面說一個tablesapce可以有1022 個datafile---;;;;;的原因(其實一個 tablespace 可以有 1023 個 datafile我建過)---;;;;;oracle10G中 block 的big datafile 的這段數(shù)據(jù)的情況是0x00000001~0xffffffff---;;;;;這也是為什么一個 big datafile 的tablesapce只有一個datafile 并且最大值為---;;;;;32T (8k的時候 : 4G*8k=32T ; 32k的數(shù)據(jù)塊的時候為128T)--- A5 02 08 00 00 00 :; scn: 0x0000.000802a5oracle是c語言寫的 這6位不正好是一個 unsigned long---;;;;;和 unsigned int的組合--- 01;;;;;:; seq: 0x01--- 02;;;;;:; flg: 0x02--- 00 00;;:; chkval: 0x0000 在 init 中設(shè)置了 db_block_checksum=true 才有值 --- 00 00;;:; unused 上面的dump文件中并沒有顯示這部分內(nèi)容---;上面的20個bytes的數(shù)據(jù)任改其中的值肯定發(fā)生ORA-XXXXX(不一定就是ora-01578 我還看見過ora-600) ------------------------; 下面的對應(yīng)上面dump 文件的第二部分 01 00 00 00; 4A 61 00 00 A3 02 08 000000602000 00 00 00 01 00 03 00; 00 00 00 00 --- 01;;;;;:typ: 1 - DATA--- 00;;;;;:只見過 0x00 沒見過其他的值 don't know--- 00;;;;;:見過有其他值 但用編輯器改這個值 在 dump 文件中顯示不出來變化--- 00;;;;;:沒見變過其他的值 don't know--- 4A 61 00 00;;;;:seg/obj: 0x614a--- A3 02 08 00 00 00 :csc: 0x00.802a3--- 00 00;;:見過有其他值 但用編輯器改這個值 在 dump 文件中顯示不出來變化;;;;--- 01;;;;;:itc: 1;下面的 ITL 條目的個數(shù)--- 00;;;;;:見過有其他值 但用編輯器改這個值 在 dump 文件中顯示不出來變化--- 03;;;;;:flg: O ver: 0x01;;;;;Object id on Block? Y---;;;;從我的觀察中 dump 出來的文件中flg;;ver;;Object id on Block---;;;;他們共同占用的這個一個字節(jié)他的規(guī)律可以從下面的情況看出--- 2進制數(shù)據(jù);;flg;;;;ver;;;;Object id on Block?---0x00 -;;;;;0x00N---0x01 0;;;;;0x00N---0x02 -;;;;;0x01Y---0x03 0;;;;;0x01Y---0x04 -;;;;;0x02Y---0x05 0;;;;;0x02Y---0x06 -;;;;;0x03 Y---0x07 0;;;;;0x03Y---0x08 -;;;;;0x04N---0x09 0;;;;;0x04N---0x0a -;;;;;0x05Y---0x0b 0;;;;;0x05Y---0x0c -;;;;;0x06Y---0x0d 0;;;;;0x06Y---0x0e -;;;;;0x07Y---0x0f 0;;;;;0x07Y---;;; ;;;;;0x10 ... 類似上面的循環(huán)了這種情況在9i上已經(jīng)改變因為ASSM的出現(xiàn)--- 00;;;;;:fsl: 0--- 00 00 00 00;;;;:fnx: 0x0------------------------; 下面的對應(yīng)上面dump 文件的第三部分 03 00 45 0000006030B4 00 00 00 0A 17 80 00; C7 00 36 00 01 20 00 0000006040A5 02 08 00 --- 03 00 45 00 B4 00 00 00; :xid:; 0x0003.045.000000b4--- 0A 17 80 00 C7 00 36 00; :uba:; 0x0080170a.00c7.36--- 01; 0;:Lck鎖定的row數(shù) 這里還用到了下一個 byte 的數(shù)據(jù)--- 2;;;;;:Flag; 2 對應(yīng)的二進制表示為 0010 正好和dump文件中的 --U- 吻合--- 00 00 A5 02 08 00;;;;;:Scn/Fsc------------------------; 下面的對應(yīng)上面dump 文件的第四部分 00 01 01 00; FF FF 14 00 B2 1F 9B 1F000060509B 1F 00 00 01 00 B2 1F--- 00;;;;:flag--- 01;;;;:ntab--- 01 00;:nrow--- FF FF;:frre--- 14 00;:fsbo--- B2 1F;:fseo--- 9B 1F;:avsp--- 9B 1F;:tosp--- 00 00;:0xe: offs--- 01 00;:0xe: nrow --- B2 1F ;:0x12:pri[0];offs=0x1fb2------------------------; 下面的對應(yīng)上面dump 文件的第五部分--- 這部分和上面的數(shù)據(jù)中間省略了很多 因為這列子中這些部分沒存儲數(shù)據(jù) 00007FF000 00 00 00 00 00 2C 01; 01 02 C1 02 --- 這是 block 中存用戶數(shù)據(jù)的地方--- 2C;;:;fb:--- 01;;:;lb: 這一行是否被lock--- 01;;:;這條記錄中有多少列的數(shù)據(jù); 從這里看出因為只用一個byte去記錄這一行有多少列---;;;;所以最多是255列 但一個表可以最多是1000列 假如table 的列大于255列 這里就會---;;;;發(fā)生鏈接 根據(jù)一行記錄的長度來看是 塊內(nèi)的鏈接或者是塊與塊直接的鏈接 ---;;;;這也是為什么table 的設(shè)計會盡量少于255列的原因--- 02;;:;第1列的數(shù)據(jù)的長度是多少--- C1 02; :;存儲在 block 中的數(shù)據(jù) '1'------------------------; 下面的對應(yīng)上面dump 文件的第一部分的 'tail: 0x02a50601' 01 06 A5 02; --- 這是用來效驗 block 是否完整的標(biāo)志 改這 block 最后的4 bytes 數(shù)據(jù)中的任意肯定ora-1578~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~上面只是講解了一個最簡單的oracle 的block 的格式 其他還有很多的情況 如 cluster , index 等long , lob , long raw 這些在 block 中的表示因為數(shù)據(jù)長度的不同都會有不同的體現(xiàn)有的時候改動block 中的任意數(shù)據(jù)不一定會發(fā)生 ORA-01578 因為下面的兩個參數(shù)沒有設(shè)置為 truedb_block_checking;db_block_checksum;這兩個參數(shù)對于system tablespace 默認(rèn)都是true 所以改變 system tablespace 中的數(shù)據(jù)肯定會發(fā)生ORA-01578隨著oracle版本的不斷升級 oracle 對block中存儲數(shù)據(jù)的正確性也在不斷的提升要求 而且通過常規(guī)的手段想去了解 oracle block 的格式也可能越來越困難
標(biāo)簽: Oracle 數(shù)據(jù)庫
主站蜘蛛池模板: 草草影院免费 | 91免费网站在线看入口黄 | 亚洲精品一区二区 | 精品一区二区三区视频 | 成人免费影视网站 | 日韩中文字幕网站 | 欧美日韩精彩视频 | 亚洲素人在线 | 国产欧美一区二区精品久久久 | 日韩精品久久久久久 | 日韩精品中文字幕一区三区 | 亚洲人的天堂男人爽爽爽 | 亚洲精品久久久久综合中文字幕 | 兔子先生节目在线观看免费 | 99精品在免费线视频 | 久久精品国产99国产精品亚洲 | 亚洲欧美一区二区三区在线播放 | 国产精品久久国产精品99 | 亚洲国产欧美日韩 | 毛茸茸年轻成熟亚洲人 | 精品99在线观看 | 午夜影院黄 | 美女亚洲视频 | 亚洲自拍偷拍图 | 国产午夜a理论毛片在线影院 | 欧美不卡在线视频 | 成人精品第一区二区三区 | 99精品在线观看 | 2021国产精品自在拍在线播放 | 深夜国产成人福利在线观看女同 | 成年人黄色网址 | 寡妇一级a毛片免费播放 | 美女互操| 1024国产欧美日韩精品 | 免费的特黄特色大片在线观看 | 黄色毛片a | 亚洲精品一区二区三区国产 | 欧美黄网在线 | 国产一区二区三区不卡在线观看 | 玖玖爱zh综合伊人久久 | 精品国产欧美一区二区最新 |