Types of changes to data

The three basic types of changes to a data page are changes to control information, changes to database pointers, and changes to the data.

Begin program-specific programming interface information.

Changes to control information
Those changes include pages that map available space and indicators that show that a page has been modified. The COPY utility uses that information when making incremental image copies.
Changes to database pointers
Pointers are used in two situations:
  • The Db2 catalog and directory, but not user databases, contain pointers that connect related rows. Insertion or deletion of a row changes pointers in related data rows.
  • When a row in a user database becomes too long to fit in the available space, it is moved to a new page. An address, called an overflow pointer, that points to the new location is left in the original page. With this technique, index entries and other pointers do not have to be changed. Accessing the row in its original position gives a pointer to the new location.
Changes to data
In Db2, a row is confined to a single page. Each row is uniquely identified by a RID containing:
  • The number of the page.
  • A 1-byte ID that identifies the row within the page. A single page can contain up to 255 rows. (A page in a catalog table space that has links can contain up to 127 rows.) IDs are reused when rows are deleted.

The log record identifies the RID, the operation (insert, delete, or update), and the data. Depending on the data size and other variables, Db2 can write a single log record with both undo and redo information, or it can write separate log records for undo and redo.

The following table summarizes the information logged for data and index changes.

Table 1. Information logged for database changes
Operation Information logged
Insert data The new row.
  • On redo, the row is inserted with its original RID.
  • On undo, the row is deleted and the RID is made available for another row.
Delete data The deleted row.
  • On redo, the RID is made available for another row.
  • On undo, the row is inserted again with its former RID.
Update data1 The old and new values of the changed data.
  • On redo, the new data is replaced.
  • On undo, the old data is replaced.
Insert index entry The new key value and the data RID.
Delete index entry The deleted key value and the data RID.
Add column The information about the column being added, if the table was defined with DATA CAPTURE(CHANGES).
Alter column The information about the column being altered, if the table was defined with DATA CAPTURE(CHANGES).
Roll back to a savepoint Information about the savepoint.
Modify table space Information about the table space version.
LOAD SHRLEVEL NONE RESUME YES The database ID (DBID) and the page set ID (PSID) of the table space on which the operation was run.
LOAD SHRLEVEL NONE RESUME NO REPLACE The database ID (DBID) and the page set ID (PSID) of the table space on which the operation was run.
REORG TABLESPACE DISCARD The database ID (DBID) and the page set ID (PSID) of the table space on which the operation was run.
CHECK DATA DELETE YES The database ID (DBID) and the page set ID (PSID) of the table space on which the operation was run.
Point-in-time recovery by using the RECOVER utility with the following options:
  • TOCOPY
  • TOLASTCOPY
  • TOLASTFULLCOPY
  • TORBA
  • TOLOGPOINT
The database ID (DBID) and the page set ID (PSID) of the table space on which the operation was run.
EXCHANGE DATA on a clone table space The database ID (DBID) and the page set ID (PSID) of the table space on which the operation was run.
REPAIR SET DELETE The database ID (DBID) and the page set ID (PSID) of the table space on which the operation was run.
Note:
  1. If an update occurs to a table defined with DATA CAPTURE(CHANGES), the entire before-image of the data row is logged.

End program-specific programming interface information.