RelationalDBDesign 




Data Blocks  «Prev  Next»
Lesson 4 Internals of the Oracle segment header
Objective Describe the internals of the Oracle segment header.

Oracle Segment Header Internals

Segment header block

When we look at the placement of Oracle data rows within data blocks, we must understand how Oracle uses the segment header to manage data rows.
The data block header contains general block information. The segment header block is the first block of any Oracle table or index, and contains control information about free blocks, extents, and high water marks.
Let us look at the contents of this block using the MouseOver that follows.

Oracle Segment Header

Oracle internal structures for managing free space

All Oracle tables use freelists to manage free space.
One or more freelists are enabled automatically for each data and index segment. These freelists are internal structures that can never be changed, have no parameters, and are never seen by the DBA. Master freelists, transaction freelists, and process freelists are also contained in the segment header.

The role of Oracle's internal structures and freelists

To understand the role of Oracle's internal structures, we must examine the freelists in more detail.
A freelist is a list of the data blocks that are available for inserts, and is a tool for Oracle to manage free data blocks. There is a relationship between the high water mark and the freelists. Before we discuss this, let's look at some other freelist concepts.
A freelist can be thought of as a chain of block pointers or a one-way linked list, similar to a data structures linked list. As shown in the graphic below, the segment header points to the first free block, the first free block points to the second free block, and so on.


This shows a freelist as a chain of pointers.
This shows a freelist as a chain of pointers

Structures for managing free space

Oracle uses the following structures to manage free space: the master freelists, super master freelists, freelist groups, process freelists, and transaction freelists.
The SlideShow below reviews the high water mark, and other segment header internal structures Oracle uses to manage free space.

Manage free space

The high water mark and the master freelist

The high water mark is increased when a request for a new free block cannot be satisfied by the existing freelists. When this happens, Oracle will increment the master freelist by five blocks.

This shows a master freelist.
This shows a master freelist.

OPS and the super master freelist

With the Oracle Parallel Server (OPS), you have a super master freelist on block #1 of the segment. This is in addition to the master freelists that are dedicated to each freelist. We will discuss the OPS in more detail later in the course.
This shows a super master freelist.
This shows a super master freelist.


The freelist merge

A process freelist may also acquire blocks when a freelist merge occurs. A freelist merge is when the master freelist has been incremented, and Oracle moves five-block increments from the master freelist to the process list.

The role of the transaction freelist

The transaction freelist is allocated on an as-needed basis. These entries are transferred after the task has ended or committed to the process freelist, the most recently freed blocks being added to the head of the freelist chain.
This depicts a transaction freelist.
This depicts a transaction freelist

The role of the extents table


The extents table manages the extents for the object, and points Oracle to the next extent for the table or index.
This is an image of an extents table.
This is an image of an extents table

Relationship between the high water mark and freelists

It is important that you understand the relationship between freelists and the high water mark .
All blocks above the high water mark are automatically eligible to receive rows, but all blocks below the high water mark must be on the freelist. When the high water mark is increased, Oracle will move the high water mark up, in increments of five blocks, and add these blocks to the master freelist.

Oracle Segment Header Summary

Oracle has several structures for managing free space. These internal structures have an important relationship with PCTFREE and PCTUSED, and the high water mark. Listed below are some of the main points about PCTFREE and PCTUSED. You will learn more about these parameters later in the course:
Each update process reads its own freelist, and blocks only appear on one freelist.
The PCTUSED parameter determines when to perform a freelist re-link.
The PCTFREE parameter determines freelist un-link.
The next lesson discusses how to set PCTFREE for optimal performance.
Before moving on to the next lesson, click the link below to read about data block fundamentals.
Data Block Fundamentals