首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

Oracle 数据块(data block)的构造和解析

2012-07-16 
Oracle 数据块(data block)的结构和解析?First of all let’s create a new tablespace and a table:SQL c

Oracle 数据块(data block)的结构和解析

?First of all let’s create a new tablespace and a table:

SQL> create tablespace my_tbs datafile '/u01/oradata/chenlin/my_tbs.dbf' size 200m ;

?Tablespace created.

?then:

SQL> create table my_tab tablespace my_tbs as select * from dba_objects ?;

?Table created.

?Now let’s get more information about this table from DBA_SEGMENTS view:

SQL> select header_file, header_block, bytes, blocks, extents from dba_segments where segment_name='MY_TAB';


      Total Blocks............................1024      Total Bytes.............................4194304      Total MBytes............................4      Unused Blocks...........................192      Unused Bytes............................786432      Last Used Ext FileId....................12      Last Used Ext BlockId...................785      Last Used Block.........................64

?


PL/SQL procedure successfully completed.


As it has 831 blocks below and the number of block is 1023 (dump file didn’t count the header block), then there’re 1023-831=192 data blocks free (and above the hightwater mark)


Moreover, as the highwater mark is at block 64 ?and the extent has ?256 ?data blocks, then 256-64 = 192 data blocks are free,


So this means that there’s 192*4096 = 786432 bytes (768Kb) free space left .


As you see comparison of both values led us to the same results .


So in this post you’ve learned how to dump a header block of the segment and how to read it.?


ps: 如果你想真正知道oracle的block块里面真正有些什么,请耐心读完这篇文章~

?

热点排行