Home | Previous Page | Next Page   Logging and Log Administration > Checkpoints and Fast Recovery > Fast Recovery >

Details of Fast Recovery After A Full Checkpoint

Fast recovery works differently depending on whether the previous checkpoint was a full or fuzzy checkpoint. This section discusses fast recovery after a full checkpoint.

Fast recovery returns the database server to a consistent state as part of shared-memory initialization. The consistent state means that all committed transactions are restored, and all uncommitted transactions are rolled back.

Fast recovery is accomplished in the following two stages:

Fast recovery occurs in the following steps:

  1. Use the data in the physical log to return all disk pages to their condition at the time of the most recent checkpoint.
  2. Locate the most recent checkpoint record in the logical-log files.
  3. Roll forward all logical-log records written after the most recent checkpoint record.
  4. Roll back transactions that do not have an associated COMMIT or BEGIN COMMIT record in the logical log.

The paragraphs that follow describe each step in detail.

Returning to the Last-Checkpoint State

To accomplish the first step, returning all disk pages to their condition at the time of the most recent checkpoint, the database server writes the before-images stored in the physical log to shared memory and then back to disk. Each before-image in the physical log contains the address of a page that was updated after the checkpoint. When the database server writes each before-image page in the physical log to shared memory and then back to disk, changes to the database server data since the time of the most recent checkpoint are undone. Figure 92 illustrates this step.

The database server is now physically consistent.

Figure 92. Writing All Remaining Before-Images in the Physical Log Back to Disk
begin figure description - This figure is described in the surrounding text. - end figure description

Finding the Checkpoint Record in the Logical Log

In the second step, the database server locates the address of the most recent checkpoint record in the logical log. The most recent checkpoint record is guaranteed to be in the logical log on disk. Figure 93 illustrates this step.

Figure 93. Locating the Most Recent Checkpoint Record in the Logical Log
begin figure description - This figure is described in the surrounding text. - end figure description

Rolling Forward Logical-Log Records

The third step in fast recovery rolls forward the logical-log records that were written after the most recent checkpoint record. This action reproduces all changes to the databases since the time of the last checkpoint, up to the point at which the uncontrolled shutdown occurred. Figure 94 illustrates this step.

Figure 94. Rolling Forward the Logical-Log Records Written Since the Most Recent Checkpoint
begin figure description - This figure is described in the surrounding text. - end figure description

Rolling Back Incomplete Transactions

The final step in fast recovery rolls back all logical-log records for transactions that were not committed at the time the system failed. All databases are logically consistent because all committed transactions are rolled forward and all uncommitted transactions are rolled back.

Because one or more transactions possibly spanned several checkpoints without being committed, this rollback procedure might read backward through the logical log past the most recent checkpoint record. All logical-log files that contain records for open transactions are available to the database server because a log file is not freed until all transactions that it contains are closed. Figure 95 illustrates the rollback procedure. When fast recovery is complete, the database server goes to quiescent or online mode.

Figure 95. Rolling Back All Incomplete Transactions
begin figure description - This figure is described in the surrounding text. - end figure description
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]