如何顯示logical log page ?
邏輯日誌頁是沒有slot的,所以它不能被oncheck顯示出來,但是可以使用onlog來顯示。
Partnum:
Partnum可以唯一的定位一個tablespace,對於沒有分片的表只有一個partnum,但是對於已經分片的表,對於每一個dbspace上的fragment都有一個partnum。
Select hex(partnum) from systables where tabname=”table_name”;
或 Select hex(partnum) from sysmaster:systabname where tabname=”table_name”;
對於已經分片的表可以使用:
Select hex(partn) from systables t,sysfragments f where t.tabid=f.tabid And tabname=”table_name”;
或使用oncheck –pt dbname:tab_name | grep partnum 可以得到十進制的數,轉化成16進制即可。
如何顯示一個頁的內容?
Oncheck –pP chunk_number page_offset
注意:offset是從0開始的,即offset 2 指第三個頁
Oncheck –pP 1 0 就可以顯示第一個chunk的第1個頁;
Oncheck -pp partition_number logical_page_number
Oncheck –pp 0x100022 0 顯示partnum爲0x100022的表空間的邏輯頁爲0的內容。
Oncheck –pp有一些沒有被公開的參數可以使用,例如:
Oncheck –pp database:tablename rowid
但是隻有rowid大於0X100的可以使用上述語法,不能使用該語法顯示第一個bitmap page。
使用oncheck –pp 0x10001a 0x2 顯示partnum爲0X10001a的表的logical page 爲2的頁上全部內容,不能顯示該表中單獨的一行。
Page:
頁是發生I/O的最小單位,每頁由2048 bytes或4096 bytes組成,每頁的長度是16bytes,由128行或256行組成。
使用od –x rootchk可以dump出行的。每頁由page header(24page),slot table(4bytes),最後一個timestampe頁(4page)構成。
頁頭的24字節由pg_addr(4bytes),pg_stamp(4 bytes),pg_nslots,pg_flags,pg_frptr,pg_frcnt,pg_next和pg_prev。
Pg_addr由0x 001 00200組成。Pg_stamp表示頁上的數據被修改每一次paget構成。
每一頁上slot 表的最大數量是255;
在9.4之前的版本中是:chunk chunkoffset pg_stamp
在能夠支持大容量的數據之後就是pg_offet ,pg_chunk;pg_timestamp(之後修改爲pg_chksum)
實際頁頭的數據格式:
Oncheck –pP 1 0x3bf
Addr stamp nslots flag type frptr frcnt next prev
1:959 11202 14 1 data 1900 88 0 0
TYPE主要存在如下類型:
DATA tablespace data page
PARTN partition page(tablespace tablespace)
FREE tables bitmap page
CHUNK chunk free list page
REMAIN remainder page
BTREE index page
ROOTRSV root reserved page
UNKNOW default type,which include logical log pages
Slot的規律:
Slot prt len flag
1 24 134 0
2 158 134 0
3 292 134 0
4 426 134 0
。。。 。。。
Prt 第一個sloat 被找到偏移量byte
Len length of the slot in bytes
Slot 並不代表一行,因爲有個行太大,產生了跨頁的現象。
頁視圖:
Dd if=/dev/chunk1 skip=123 count=1 bs=2k |od –x
Reserver pages:
Root chunk的最前12頁爲系統保留頁,是用來記錄系統的相關信息,在每次CKPT的時候被更新。從第三個頁開始之後所有的系統保留頁都是成對出現的,它們記錄了不同的類型結構,oninit 的對系統保留頁的改變是成對,目的是使如果一個頁被損壞,另外一個頁能夠被
作爲備份來使用。
其具體結構如下:
Page 0 :copyright page,包含IDS的版本信息和IDS系統被創建的時間
Page 1 :configuration 包含了onconfig配置文件的內容,由IDS啓動的時候來讀取
Page2、3:ckpt/logs記錄最後一次CKPT的時間和邏輯日誌頁的定位信息及邏輯日誌的狀態
Page 4、5:dbspaces 記錄了dbspaces的狀態、定位信息、創建時間、和數據信息
Page 6、7:primary chunks 記錄當前主CHUNK的路徑名稱、大小、偏移量、狀態
Page 8、9:mirror chunks
Page a、b:archive 記錄最近的歸檔信息
Chunk free list:
Chunk free list記錄了chunk中空閒的extents。
Tablespace tablespace:
Tablespace tablespace描述了所有的定位信息和數據結構在特定的dbspaces上的所有的Tablespace。其內容主要有如下信息:
- the number and location of extents
- the number and description of columns
- an array of index key information
- the database and table name
Tablespace tablespace在rootchunk的初始化大小是250 pages。
Database tablespace :
它包含了一個實例中的所有的Informix數據庫信息,其內容主要如下:
Database name
Database number
Date and time the database is created
The tablespace number of the systables system catalog table for this database
Flags that show the loggin mode for the database
可以使用oncheck –pe來定位database tablespace的物理定位信息,你可以查看sysdatabases表在sysmaster database中分佈信息。
非rootchunk的數據分佈信息:
Reserved pages \ chunk free list \ Tablespace tablespace \ tblspace extents 第一個chunk
Reserved pages \ chunk free list 對於非第一個CHUNK
Reserver pages:
任何非rootchunk前兩個頁爲系統保留頁,但是這兩個頁是空的,甚至沒有被初始化出頁頭,這兩個也被設計將來有一天可用。
chunk free list 用來計算chunk中有多少空閒的extent;
Tablespace tablespace:每一個dbspaces都包含一個Tablespace tablespace,也稱做分區表。第一個Tablespace tablespace的extent 總是存在於dbspaces的第一個chunk上。當其他的extent被分佈的時候,他們用來定位dbspace上是否有足夠的空間。這種dbspaces上的分區表的初始化大小是50頁。