Data Consistency, Recovery, and Migration 4-21
Dbspace Logging
In general, an insert or an update begins when a database server process
requests a row. OnLine identifies the page on which the row resides and
attemptsto locate the page in the OnLine shared-memory buffer pool. If the
page is not already in shared memory, it is read into shared memory from
disk.
Beforea dbspace data page is first modified, a copy of the unchanged page is
storedin the physical log buffer. This copy of the “before-image” of the page
iseventually flushed from the physical log buffer to the physical log on disk.
The “before-image” of the page plays a critical role in fast recovery. (While
thedata page is in shared memory, subsequent modifications do not require
another “before-image” to be stored in the physical log buffer.)
Data from the application tool process is passed to the database server
process. The data is stored in the private data portion of the virtual address
spaceof the process. 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 by the database server process.
At the same time, all information needed to roll back or re-create this
operation is written to the logical log buffer in the form of a transaction
record.
The physical log buffer must flush before the data buffer flushes 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
checkpointoccurs. (During a checkpoint all modified page in shared memory
are flushed to disk providing a consistent point from which to recover from
an uncontrolled shutdown. Refer topage 2-72 for a detailed discussion of
what happens during a checkpoint.)
After the physical log buffer is flushed, the shared-memory page buffer is
flushed and the data page is written to disk. (Refer to page 2-74 for more
details about the relationship between physical log buffer flushing and
shared-memory buffer pool flushing.)
Whenthe logical log buffer is flushed, the logical log record is written to the
current logical log file on disk. A logical log file cannot become free (and
available for reuse) until all transactions represented in the log file are
completed and the log file is backed up to tape. This ensures that all open
transactions can be rolled back, if required. (Refer topage 2-66 for more
details about when the logical log buffer is flushed.)