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.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章