This section describes the details of physical logging. It is provided to satisfy your curiosity; you do not need to understand the information here in order to manage your physical log.
The database server performs physical logging through six steps that are shown in the table below.
Physical-Logging Steps the Database Server Performs | Detailed Explanation |
---|---|
Reads the data page from disk to the shared-memory page buffer (if the data page is not there already). |
When a session requests a row, the database server identifies the page on which the row resides and attempts to locate the page in the database server shared-memory buffer pool. If the page is not already in shared memory, it is read into the resident portion of the database server shared memory from disk. |
Copies the unchanged page to the physical-log buffer. |
If the before-image of a modified page is stored in the physical-log buffer, it is eventually flushed from the physical-log buffer to the physical log on disk. The before-image of the page plays a critical role in restoring data and fast recovery. For more details, see Physical-Log Buffer. |
Reflects the change in the page buffer after an application modifies data. |
The database server reflects changes to the data in the shared-memory data buffer. Data from the application is passed to the database server. After a copy of the unchanged data page is stored in the physical-log buffer, the new data is written to the page buffer already acquired. |
Flushes the physical-log buffer to the physical log on disk. |
The database server flushes the physical-log buffer before it flushes the data buffer to ensure that a copy of the unchanged page is available until the changed page is copied to disk. The before-image of the page is no longer needed after a checkpoint occurs. For more details, see Flushing the Physical-Log Buffer. |
Flushes the page buffer and writes it back to disk. |
After the physical-log buffer is flushed, the shared-memory page buffer is flushed to disk (such as during a checkpoint), and the data page is written to disk. Only non-fuzzy pages are flushed to disk during a fuzzy checkpoint. For conditions that lead to the flushing of the page buffer, see Flushing Data to Disk. |
When a checkpoint occurs, flushes the physical-log buffer to the physical log on disk and empties the physical log. |
A checkpoint can occur at any point in the physical-logging process. The database server performs two types of checkpoints: full and fuzzy. For information, see Checkpoints. The database server manages the physical log as a circular file, constantly overwriting unneeded data. The checkpoint procedure empties the physical log by resetting a pointer in the physical log that marks the beginning of the next group of required before-images. |