如何显示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页。