Roll-Back Recovery [ TurboIMAGE/XL Database Management System Reference Manual ] MPE/iX 5.0 Documentation
TurboIMAGE/XL Database Management System Reference Manual
Roll-Back Recovery
Roll-back recovery is another TurboIMAGE/XL recovery option. Roll-back
recovery provides rapid recovery of database data integrity following a
"soft" system crash (that is, system failure or loss of working memory).
The roll-back feature is invoked through the DBRECOV utility and requires
only the current database log files to restore data integrity. Note that
ILR is not needed for roll-back recovery.
NOTE For roll-back recovery, the user log file and the database must be
on the same volume set when logging to disk. When logging to tape,
the database and the log file must be on the system volume set.
A database backup copy is not required for roll-back recovery. Regular
backup of the database is recommended, however, and is always required
for roll-forward recovery in the event of a more serious problem (for
example, a disk head failure, or problems occurring while roll-back
recovery is in progress).
With roll-back enabled prior to a system failure, a record of each user
transaction in the sequence of occurrence is available to determine which
transactions were incomplete at the time of failure. When invoked, the
roll-back recovery feature will "roll back," or undo, any incomplete
database transactions in the log file following a soft system crash.
NOTE A database must be enabled for roll-back before roll-back recovery
can be performed.
The following diagram illustrates the transactions of three different
users at the time of a system failure:
In the above illustration, the first user has completed one transaction
(T1) and aborted another (T4) prior to the system failure. Users two and
three have each completed two transactions, and each has one incomplete
transaction at the time of failure. Individual database transactions T1,
T2, T3, T5, and T6 were completed and are properly reflected in the
database following system failure. Transactions T7 and T8, however, were
incomplete at the time of system failure, causing an incomplete
modification of data to be reflected in the database. These incomplete
transactions (T7 and T8) are then rolled back (undone) to their
beginning, returning all affected data in the database to their original
state before T7 and T8 began execution.
When transaction T4 is aborted, TurboIMAGE/XL completes the transaction
by issuing an abnormal end (DBABEND). This transaction is then seen as
completed by the roll-back feature and is not normally rolled back. If
the aborted transaction is also to be rolled back, the following DBRECOV
command must be issued before issuing the DBRECOV >RUN command (refer to
the discussion of DBRECOV in chapter 8):
>CONTROL NOABORTS
The above command string causes the aborted transaction to be treated as
an incomplete transaction during roll-back recovery. When >CONTROL
NOABORTS is used, recovery must be performed at system startup time
before anyone modifies the database. Refer to "Record Numbers" under the
DBRECOV >CONTROL discussion in chapter 8 for considerations when using
the >CONTROL command.
Enabling the Roll-Back Feature
To enable the roll-back feature complete the following sequence:
1. Set the logid and build a log file (if logging to disk) as shown
in steps 2 through 6 of "Logging Preparation" earlier in this
chapter.
2. For each particular database, disable access and enable the
roll-back and recovery features by entering the following DBUTIL
commands. You can also enable the MUSTRECOVER option if you wish
to use it.
>>DISABLE database name FOR ACCESS
>>ENABLE database name FOR ROLLBACK,RECOVERY
>>ENABLE database name FOR MUSTRECOVER
Enable any other appropriate flags as discussed in step 7 under
"Logging Preparation."
If the logid was not set and/or the log file was not built before
the >>ENABLE command is issued for roll-back recovery, a warning
message that the logid or the log file is non-existent prints on
the screen. Enable any other appropriate flags as discussed in
step 7 under "Logging Preparation." Enabling for roll-back or
MUSTRECOVER automatically enables the database for logging.
3. Make a backup copy of the database as discussed in step 8 under
"Logging Preparation."
4. Start the logging process and enable user access to the
appropriate databases as shown in "Logging Maintenance," earlier
in this chapter. After the logid has been set and the log file
built, DBUTIL automatically enables logging when roll-back is
enabled. Note that ILR is not needed for roll-back recovery;
however, if ILR is enabled together with roll-back recovery,
logging and ILR must be disabled separately.
When roll-back recovery is enabled, DBUTIL sets a roll-back flag in the
root file to indicate that roll-back recovery is enabled for the
database. DBUTIL also reserves six words in the root file for the
roll-back time stamp (three words for the previous time stamp and three
words for the current time stamp). The roll-back time stamp is updated
and logged in the log file and in the root file when the database is
first opened. Roll-back recovery then uses the time stamp during
recovery to verify the correct log file for each database.
Note that if the database and the log file are not on the same volume
set, an error is issued.
CAUTION In the event of a system failure, do not restart user logging
before running DBRECOV. Log records may have been lost due to
the system failure. If user logging is resumed without a
recovery, the resulting discontinuous log file would cause
invalid results in the event of a subsequent recovery. To
prevent access to the database after a system failure without
recovery, enable the MUSTRECOVER feature when you enable the
roll-back feature.
Disabling the Roll-Back Feature
To disable the roll-back feature, make sure that no users are accessing
the database involved. Disable the roll-back feature by entering the
following DBUTIL command string:
>>DISABLE database name FOR ROLLBACK
When roll-back is disabled, DBUTIL resets the roll-back flag and
roll-back time stamp, but not the logging flag; therefore, logging is
still enabled.
CAUTION DO NOT DISABLE ROLL-BACK IF ROLL-BACK RECOVERY MUST BE USED
LATER. Disabling roll-back resets the logging time stamp. After
the logging time stamp is reset, roll-back recovery cannot be
performed with the current log file on the named database. The
data in the database is considered correct and therefore cannot
be rolled back.
When the >>DISABLE command is issued, DBUTIL prompts a warning to remind
you that the time stamp will be erased and prompts for a response as
follows:
WARNING: ROLLBACK time stamp will be erased.
Please type Y to confirm your disable command>>
If you enter Y, DBUTIL continues to disable roll-back. If Y is not
entered, the >>DISABLE command is not performed.
Performing Roll-Back Recovery
To complete the transaction roll-back process following a system failure,
perform the following steps:
1. Following a start recovery operation to bring up the system,
locate the applicable log file media to be used for transaction
roll-back. If logging to tape, the correct tape needs to be
mounted. If using the MPE/iX CHANGELOG feature and there are
multiple log file tapes, this will be the first tape of the
series. If logging to disk, TurboIMAGE/XL automatically locates
the first log file (for example, LOGF001) in the given logging
cycle by checking the beginning of the root file for the logid.
Note that the system boot-up process writes a crash record to the
last volume of the user log set. If a start recovery operation is
not performed, this will not occur, causing DBRECOV to issue a
warning.
2. Make a database backup copy in case a system failure occurs during
the roll-back recovery process.
3. Enter the following MPE/iX command string:
:RUN DBRECOV.PUB.SYS
4. Enter the >CONTROL NOSTORE command of DBRECOV to allow recovery to
proceed whether or not the DBSTORE flag is set.
5. Enter the following DBRECOV command (where database name is the
name of individual databases to be rolled back):
>ROLLBACK database name [,database name2,....,database nameN]
6. Enter all other desired DBRECOV commands (>FILE, >CONTROL with
other options except NOSTORE shown above, and >PRINT). Note that
the >FILE command's optional parameter rmode is not used with the
roll-back feature. Refer to chapter 8 for more information.
7. If you want to recover the databases, enter the DBRECOV >RUN
command. Otherwise, enter the >EXIT command, and DBRECOV
terminates, and no recovery takes place.
>RUN
After the >RUN command is given, DBRECOV asks you to mount the log
tape (if the log file medium is tape). Continue the roll-back
process as directed by messages returned to both the console and
the terminal screen.
8. If the CHANGELOG command or GETLOG AUTO option was used during
logging and the logging file medium is tape, the following message
appears on the terminal screen and the console:
Reply CONtinue on console when logfile is ready
When the required log file is available, enter the response CON to
the console request from DBRECOV.
Note that the response is in a form similar to REPLY for a tape mount
used when storing or restoring tapes; that is, you need to enter the
Process Identification Number (PIN). After the >RUN command is given, the
DBRECOV program recovers the specified databases, creates specified
user-recovery files, and terminates. The DBRECOV program could be
terminated alternatively without any recovery taking place with an >EXIT
command.
For recovery to succeed, you must have access to the log file. This
implies either knowing the maintenance word and having system manager
(SM) or operator (OP) capability, or being the creator of the log
identifier with read access to the log file if it resides in a different
logon group and account. If the log file is on tape, you must know the
volume identifier.
NOTE If the operator is unsure of the volume identifier, it is displayed
on the console when the tape is mounted.
If the database creator and the creator of the log identifier are not the
same, and if the disk log file and the database are in two separate
accounts, follow the steps listed below for recovery to proceed:
1. Assign a maintenance word to the database.
2. Logon as the creator of the log identifier.
3. Fully qualify the database name when issuing the >ROLLBACK
command.
4. Specify the maintenance word.
MPE/iX Cleanup Mode and Roll-Back Recovery.
In the event of a system failure and subsequent start recovery operation,
MPE/iX attempts to clean up any user log files that were open at the time
of the failure. The cleanup procedure involves writing any records left
in the system log file disk buffer to the user log file. Note that for
roll-back recovery without this cleanup, transactions are not lost during
a start recovery operation because they are not held in the memory
buffer. You should not cancel (from the console) this cleanup procedure
if the log file is on tape. Canceling the start recovery operation for
tape log files will cause rollback recovery to fail.
The advantage of the cleanup procedure is that fewer user log records
written just prior to the failure are lost. For tape files, the
disadvantage is the time it takes for the tape to be rewound and
sequentially scanned until the end-of-file is detected so that the
remaining records can be appended to the end.
The TurboIMAGE/XL recovery program DBRECOV does not require the cleanup
to be performed. If it is not performed, however, DBRECOV most likely
will report a sequence or checksum error when the discrepancy caused by
the failure is encountered. This would cause DBRECOV to assume the
end-of-file has been reached.
DBRECOV Abort Message
If DBRECOV aborts before recovery completes, the following information is
printed:
Abort occurred on database: dbname dbgroup dbaccount
Total database open count: #open Current open count: #open
Process user is: dbuser dbgroup dbaccount Running program: progname
Log file name: logfilename Logging ID: logid
Log file record number: nnnnnnnn Transaction type: xx
Transaction date/time from log record: day, month, dd, year, time
Last successful transaction #: nn
First log record # of last successful transaction: nn
Record the information, set the log file, locate the database store, and
contact your HP support representative.
MPE/iX 5.0 Documentation