Units of recovery and points of consistency

A unit of recovery begins with the first change to the data after the beginning of the job, or following the last point of consistency. The unit of recovery ends at a later point of consistency.

A unit of recovery is the work that changes Db2 data from one point of consistency to another. This work is done by a single Db2 DBMS for an application. The point of consistency (also referred to as sync point or commit point) is a time when all recoverable data that an application program accesses is consistent with other data.

The following figure shows an example of units of recovery within an application program.

Figure 1. A unit of recovery within an application process
Begin figure description. This figure depicts events in an application relative to time. End figure description.

In this example, the application process makes changes to databases at SQL transactions 1 and 2. The application process can include a number of units of recovery or just one, but any complete unit of recovery ends with a commit point.

For example, a bank transaction might transfer funds from account A to account B. First, the program subtracts the amount from account A. Next, it adds the amount to account B. After subtracting the amount from account A, the two accounts are inconsistent. These accounts are inconsistent until the amount is added to account B. When both steps are complete, the program can announce a point of consistency and thereby make the changes visible to other application programs.

Normal termination of an application program automatically causes a point of consistency. The SQL COMMIT statement causes a point of consistency during program execution under TSO. A sync point causes a point of consistency in CICS® and IMS programs.