Saturday, January 13, 2018

Overview of Data Blocks

The Database Block or simply Data Block, is the smallest size unit for input/output from/to disk in an Oracle database.Oracle Database manages the logical storage space in the data files of a database in a unit called a data block, also called an Oracle block or page. A data block is the minimum unit of database I/O.
Data Blocks and Operating System Blocks At the physical level, database data is stored in disk files made up of operating system blocks.A data block may be equal to an operating system block in terms of size, or may be larger in size, and should be a multiple of the operating system block. The database requests data in multiples of data blocks, not operating system blocks.

DB_OS_block
When the database requests a data block, the operating system translates this operation into a requests for data in permanent storage. The logical separation of data blocks from operating system blocks has the following implications:
  • Applications do not need to determine the physical addresses of data on disk.
  • Database data can be striped or mirrored on multiple physical disks etc.
Oracle Data Block

Data Blocks is smallest logical unit to store Oracle Data.
  • One data block represent specific number of bytes on physical hard disk
  • Data Block in Oracle is also called as  logical blocks, Oracle blocks, or pages
  • Data Block size is usually multiple of operating system block size
  • You can have multiple block sizes with in single database
  • Block Size is specified by initialization parameter DB_BLOCK_SIZE
Architecture of Oracle Data Block

Every data block has a format or internal structure that enables the database to track the data and free space in the block. This format is similar whether the data block contains table, index, or table cluster data.

Data Block Overhead

Oracle Database uses the block overhead to manage the block itself. The block overhead is not available to store user data.The data block header, table directory, and row directory are referred to collectively as overhead. Some block overhead is fixed in size; the total block overhead size is variable. On average, the fixed and variable portions of data block overhead total 84 to 107 bytes.
DB_block


Header (Common and Variable) part contains general information about the block, including disk address and segment type(for example, data or index). For blocks that are transaction-managed, the block header contains active and historical transaction information
Table Directory portion of the data block contains information about the table having rows in this block it also contains metadata about tables whose rows are stored in this block and In a table cluster, multiple tables can store rows in the same block.
Row Directory  describes the location of rows in the data portion of the block.The row directory entry contains a address(pointer) to the location of the row on the data block .
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).
Row Data  part of the block contains the actual data, such as table rows or index key entries

No comments:

Post a Comment