TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)
Chapter 7 313
Logging and Recovery
Logical Transactions
Logical Transactions
A Definition
TurboIMAGE/XL logging and recovery (via DBRECOV) provide the ability to restore the
database to a consistent state after a system failure. To understand how this is done, it is
important to understand the concept of a logical transaction. A logical transaction is a
sequence of one or more procedure calls that are considered one logical unit of work. Table
7-1. describes the types of logical transactions: static, multiple database, dynamic, and
dynamic multiple database.
Table 7-1. Types of Logical Transactions
Transaction Definition
Static A logical transaction that begins with a DBBEGIN call and ends with a DBEND call.
A static transaction spans only one database and uses DBBEGIN mode 1 and
DBEND mode 1 or 2.
Multiple
database
A logical transaction that begins with a DBBEGIN mode 3 or 4 call and ends with a
DBEND mode 3 or 4 call. A multiple database transaction (MDBX) spans more
than one database and can be recovered with roll-back or roll-forward recovery.
Programmers may be tempted to call DBBEGIN twice (once for each database),
update both databases, and then call DBEND twice in an attempt to implement
this capability. However, a system failure during the "window" between the two
final calls to DBEND will result in the recovery of the transaction for the first
database and its suppression on the second. To perform a transaction accessing
multiple databases, use a multiple database transaction.
Dynamic A logical transaction that begins with a DBXBEGIN mode 1 call and ends with a
DBXEND mode 1 or 2 call. A dynamic transaction spans only one database. A call
to DBXUNDO or a program abort will cause a dynamic transaction to be rolled back
dynamically. If a system failure occurs, the dynamic transaction will be rolled
back at the first call to DBOPEN for the database after the system is restarted.
However, in the event of a media failure, DBRECOV roll-forward recovery can be
used on dynamic transactions as long as user logging has first been enabled.
Dynamic
multiple
database
A dynamic transaction that spans multiple databases and begins with a
DBXBEGIN mode 3 call and ends with a DBXEND mode 3 call. The total number of
databases then can be included in a dynamic multiple database transaction is 15.
The
baseid
parameter of DBXBEGIN mode 3 includes the number of databases and
their respective base-ids. A call to DBXUNDO or a program abort will cause a DMDBX
to be rolled back dynamically. In essence, modifications to all databases involved
in DMDBX will be rolled back. If a system failure occurs, the dynamic transaction
will be rolled back at the first call to DBOPEN for the databases after the system is
restarted. However, in the event of a media failure, DBRECOV roll-forward recovery
can be used on dynamic transactions as long as user logging has first been
enabled.