DBRECOV Commands Used with Roll-Forward and Roll-Back Recovery [ TurboIMAGE/XL Database Management System Reference Manual ] MPE/iX 5.0 Documentation
TurboIMAGE/XL Database Management System Reference Manual
DBRECOV Commands Used with Roll-Forward and Roll-Back Recovery
The following DBRECOV commands are used for either roll-forward or
roll-back recovery:
CONTROL Specifies the conditions for recovery.
FILE Sorts the log file by individual users and/or user
identifiers, and designates an MPE/iX file as the
destination for each user's log records.
PRINT Displays information before you actually initiate
recovery with the >RUN command.
RECOVER Designates the name of a database to be recovered
using roll-forward recovery.
ROLLBACK Designates the name of a database to be rolled
back.
RUN Initiates recovery of the specified database.
These commands are discussed below; refer to chapter 8 for more detailed
information.
CONTROL Command
The >CONTROL command is used to specify the conditions for recovery. If
the >CONTROL command is not issued, the following default conditions must
be met for recovery to succeed:
* The database time stamp in the root file must correspond with the
time stamp in each DBOPEN log file record.
* The DBSTORE flag must be set in the database root file.
* No errors are allowed in job (batch) execution.
* Transactions that are incomplete due to program aborts are
recovered.
The >CONTROL command can be used to override these conditions. Each
override option can be negated by specifying its default option, and vice
versa, as follows:
Option Default Option
---------------------------------------------------
NOMDBX MDBX
NOSTAMP STAMP
NOSTORE STORE
NOABORTS ABORTS
MODE4 MODEX
STATS NOSTATS
ERRORS=nnnn ERRORS=0 (job) or
ERRORS=30,000 (session)
STOPTIME=dateX timeX STOPTIME=dateY timeY
EOF=pppp EOF=qqqq
The initial default condition for stop time and end-of-file is that none
is imposed on recovery. When a particular date or record number has been
specified by STOPTIME or EOF, it can be changed by specifying a new date
or record number.
The following provides an example of the override:
>CONTROL NOSTAMP,STAMP
Because STAMP was entered after NOSTAMP, STAMP negates NOSTAMP, so that
recovery proceeds with the time-stamp check intact.
For the options and form of the >CONTROL command, refer to the discussion
of the >CONTROL command of the DBRECOV utility in chapter 8. Note that
the >CONTROL command does not specify a database. Therefore, all
>CONTROL options (except NOSTORE which must be issued before recovery on
a specified database is performed) apply to all databases being
recovered.
FILE Command
The recovery file facility is an interface between the recovery system
and the application program. With the >FILE command, you sort the log
file by individual users and/or user identifiers, and designate an MPE/iX
file as the destination for each user's log records.
The recovery file facility is based on the concept of transactions within
transaction blocks. A transaction block consists of all transactions
between a call to DBOPEN and a call to DBCLOSE (see Figure 7-1
earlier in this chapter). Within each transaction block, a transaction
is defined as one of the following:
1. A single call to DBPUT, DBUPDATE, or DBDELETE if not preceded by a
call to DBBEGIN (or DBXBEGIN if logging is enabled), or
2. A sequence of calls beginning with a call to DBBEGIN (or DBXBEGIN
if logging is enabled), followed by any number of calls to DBPUT,
DBUPDATE, or DBDELETE and ending with a call to DBEND (or DBXEND
if logging is enabled).
For each transaction block, the >FILE command returns the initial DBOPEN
log record to the user recovery file. The DBCLOSE record is returned as
well, unless one of the following occurs:
1. All of the transactions within the block could not be recovered,
or
2. There was no DBCLOSE log record for this block on the log file.
This happens when the system fails while the database is open.
Consequently, an application can determine the outcome of recovery to
some extent by examining the number of DBOPENs and DBCLOSEs or pairs of
DBBEGIN and DBEND (or DBXBEGIN and DBXEND if logging is enabled) log
records returned to the user recovery file. If there are as many calls
to DBCLOSE as to DBOPEN, it is likely that all transactions were
successfully recovered. However, the possibility exists that an entire
transaction block was lost due to the system failure if the block was
very short. Fewer calls to DBCLOSE indicate the possibility that some
transactions were lost and need to be re-entered. More information about
recovery can be inferred from the recovery file by using the optional
rmode and fmode parameters. These parameters return transaction
information to the user recovery files in addition to the intrinsics
DBOPEN and DBCLOSE. Rmode refers to transactions that recovered
successfully; fmode refers to transactions that failed to be recovered.
Refer to the DBRECOV >FILE command for details of operation.
PRINT Command
The >PRINT command is an option used to display information before
actually initiating recovery with the >RUN command. If DBTABLE is
specified in the >PRINT command, the names of the databases specified for
recovery by >RECOVER commands are returned. Note that no statistics are
returned with the >PRINT DBTABLE command, because none exist before the
log file is read. If you need these statistics without actually
performing the recovery, use >CONTROL STATS to display this information.
If FILETABLE is specified in the >PRINT command, file references, user
references, fmodes and rmodes specified by >FILE commands are returned.
These tables, along with statistics, are also printed when recovery is
complete.
RECOVER Command
The >RECOVER command designates the name of a database to be recovered
using roll-forward recovery. If more than one database has logged to the
same log file, they can be recovered concurrently by entering the
database names separated by a comma.
If the database copy was stored with a procedure other than DBSTORE (for
example, MPE/iX STORE), the DBSTORE flag will not have been set in the
database root file. If you are sure you have restored the correct,
unmodified version of the database, and wish to use it for recovery, the
>CONTROL NOSTORE option must be entered before the >RECOVER command can
succeed (refer to the discussion of >CONTROL in chapter 8).
Other conditions necessary for the success of the >RECOVER command
include:
* The database must be accessible to you from your logon group and
account.
* The log identifier must not have been altered since the log file
was generated (see "Step 6--Setting the Log Identifier," earlier
in this chapter).
* The database must be enabled for recovery.
* All databases specified for recovery must contain the same log
identifier.
* You must be the database creator, or know the database maintenance
word.
* You must either be the creator of the log identifier, or have
system manager (SM) or operator (OP) capability.
* No other users are accessing the database. The database may be
concurrently accessed by users when the >CONTROL command is
specified with the MODE4 option. Refer to the >CONTROL MODE4
command discussed with DBRECOV in the next chapter.
If the >RECOVER command succeeds, recovery can be initiated by typing the
>RUN command.
ROLLBACK Command
The >ROLLBACK command is used for roll-back recovery. It designates the
name of a database to be rolled back. Any incomplete transactions
following a system failure are rolled out. Multiple databases may be
roll-back recovered by entering more than one database name after the
command.
Conditions necessary for the success of the >ROLLBACK command include the
following:
* The database must be accessible to you when running DBRECOV. If
the database resides in a group or account different from the your
logon, the MPE/iX file security must permit the user read and
write access to the database files.
* The log identifier characteristics (name, password, log file name,
and device type) must not have been altered since the log file was
generated.
* The database must be enabled for recovery and roll-back.
* All databases specified for roll-back recovery must contain the
same log identifier.
* You must be the database creator, or know the database maintenance
word.
* You must either be the creator of the log identifier, or have
system manager (SM) or operator (OP) capability.
* No other users can be accessing the database when >ROLLBACK is
called. The database may be concurrently accessed by users when
the >CONTROL command is specified with the MODE4 option.
Note that the >ROLLBACK command itself does not initiate recovery, but
makes several preparatory checks. The recovery system is actually
initiated by the >RUN command.
RUN Command
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, the person running DBRECOV (usually the database
administrator) 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 on disk in a different logon group
and account. If the log file is on tape, the user must be able to
provide the volume identifier to the operator mounting the tape.
MPE/iX 5.0 Documentation