TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)
Chapter 7 319
Logging and Recovery
Dynamic Roll-Back Recovery
Dynamic Roll-Back Recovery
Dynamic roll-back allows a more timely recovery of databases than is possible with
DBRECOV. Dynamic roll-back eliminates the overhead incurred when a database is enabled
for user logging and permits database access to continue, even while other users are
accessing a database.
Using XM, uncommitted logical transactions can be rolled back dynamically (online) while
other database activity is occurring. This is accomplished through the use of three
intrinsics: DBXBEGIN, DBXEND, and DBXUNDO.
DBXBEGIN and DBXEND mark the beginning and end of the dynamic transaction which can
be for one or multiple databases. The dynamic transaction can be rolled back in the
following ways:
• Programmatically with a call to DBXUNDO.
• Automatically when the application aborts or a system failure occurs within the
transaction.
In any case, those transactions begun after the call to DBXBEGIN that do not have a
corresponding call to DBXEND will be rolled back. When you use DBXUNDO, your program
logic must ensure that it does not call DBXEND subsequently; otherwise, you will get an
error.
Use the following sequence of operations when modifying a database with dynamic
transactions:
1. Call DBLOCK for each database to be included in the dynamic transaction to lock all data
that must not be changed by other processes during the transaction. This includes data
to be read and data to be modified.
2. If you wish, read data using DBFIND and DBGET to determine the necessary
modifications.
3. If this is a multiple database transaction, ensure that DBCONTROL mode 7 is done at
least once for each of the databases before including in the dynamic transaction.
4. Call DBXBEGIN to declare the beginning of modifications.
5. Make modifications using DBPUT, DBDELETE, or DBUPDATE.
For every DBPUT, DBDELETE, or DBUPDATE, the status must be checked before
proceeding further. If an error is returned indicating the failure of the intrinsic, the
choices are:
a. Call DBXEND. The successful modifications completed within this dynamic
transaction will not be rolled back.
b. Call DBXUNDO to roll back the entire transaction. Even successful modifications
completed within one or more databases included in this dynamic transaction will be
rolled back. That is, for DMDBX, DBXUNDO affects all databases included in the
DBXBEGIN call.
c. Continue with the remainder of the dynamic transaction even though this intrinsic