block的一些概念

[url]http://space.itpub.net/12361284/viewspace-119542[/url]

Oracle manages the storage space in the datafiles of a database in units called data blocks. A data block is the smallest unit of data used by a database. In contrast, at the physical, operating system level, all data is stored in bytes. Each operating system has a block size. Oracle requests data in multiples of Oracle data blocks, not operating system blocks.
(block是数据库中使用的最小的存储单元,那么在OS级别上,数据的存储都是按照bytes来计算,每种OS也有相应的block size,而Oracle中呢,对于任何数据的操作都是以block来计算。而这种block和os level的block大小可能会不同,联想一下hot backup中的split block概念)

The standard block size is specified by the initialization parameter DB_BLOCK_SIZE. In addition, you can specify of up to five nonstandard block sizes. The data block sizes should be a multiple of the operating system's block size within the maximum limit to avoid unnecessary I/O. Oracle data blocks are the smallest units of storage that Oracle can use or allocate.
(Oracle中除了标准db_block_size定义的block size外还有5种(db_nk_cache_size,db_nk_block_size)非标准的block size,其实这样做的目的主要就是为了可传输表空间的需要,而且Oracle中的block size一定要是OS block size的几倍,这样可以最大限度上避免一些不必要的I/O读写.)

Data Block Format

Header
----------
The header contains general block information, such as the block address and the type of segment (for example, data or index).
(block header一般包括了数据块的信息,比如block address,当然还有block所属段的类型)

Table Directory
---------------------
This portion of the data block contains information about the table having rows in this block.
(这里主要记录了这个块中包含的rows,是属于那些table的)

Row Directory
-------------------
This portion of the data block contains information about the actual rows in the block (including addresses for each row piece in the row data area).
(这里主要记录了这个块中,row data部分所包含的rows的address等等)

After the space has been allocated in the row directory of a data block's overhead, this space is not reclaimed when the row is deleted. Therefore, a block that is currently empty but had up to 50 rows at one time continues to' have 100 bytes allocated in the header for the row directory. Oracle reuses this space only when new rows are inserted in the block.

Row data
-------------
This portion of the data block contains table or index data. Rows can span blocks.
(row是可以跨数据块的)

Free Space
----------------
Free space is allocated for insertion of new rows and for updates to rows that require additional space (for example, when a trailing null is updated to a nonnull value). Whether issued insertions actually occur in a given data block is a function of current free space in that data block and the value of the space management parameter PCTFREE.

In data blocks allocated for the data segment of a table or cluster, or for the index segment of an index, free space can also hold transaction entries. A transaction entry is required in a block for each INSERT, UPDATE, DELETE, and SELECT...FOR UPDATE statement accessing one or more rows in the block. The space required for transaction entries is operating system dependent; however, transaction entries in most operating systems require approximately 23 bytes.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章