Example 1
To prevent corruption of your databases, check your CSN and TSN
values and set them to zero based on when they approach the
maximum. First, enter an RMU Dump command to display the next
CSN and next TSN values:
$ RMU/DUMP/HEADER=(SEQUENCE_NUMBERS) MF_PERSONNEL
.
.
.
Sequence Numbers...
- Transaction sequence number
Next number is 0:256
Group size is 0:32
- Commit sequence number
Next number is 0:256
Group size is 0:32
If the next CSN and the next TSN values are approaching the
maximum number allowed, you must perform the following operations
to initialize all TSN and CSN values to the value zero in your
database. The operation might take some time to execute as it
writes to every page in the database.
First, create a backup file for the database. Then restore
the database and initialize the CSN and TSN values with the
Initialize_Tsns qualifier. Then, enter an RMU Dump command again
to examine the next CSN and next TSN values. This example shows
that both values have been set to zero. If you displayed the
database pages, you would also notice that all TSN and CSN values
are set to zero.
$ RMU/BACKUP MF_PERSONNEL MF_PER_124.RBF
$ RMU/RESTORE/ONLY_ROOT /INITIALIZE_TSNS MF_PER_124.RBF
$ RMU/DUMP/HEADER=(SEQUENCE_NUMBERS) MF_PERSONNEL
.
.
.
Sequence Numbers...
- Transaction sequence number
Next number is 0:0
Group size is 0:32
- Commit sequence number
Next number is 0:0
Group size is 0:32
Example 2
Perform the following to set the TSN and CSN values to a number
that you select; a number that is greater than or equal to the
next CSN and next TSN values. If the number you have selected
is less than the next CSN and next TSN values recorded in the
database header, you receive an error as follows:
$ RMU/RESTORE/ONLY_ROOT/SET_TSN=(TSN=40,CSN=40)
_$ MF_PERSONNEL.RBF
%RMU-F-TSNLSSMIN, value (0:40) is less than minimum
allowed value (0:224) for /SET_TSN=TSN
%RMU-F-FTL_RSTR, Fatal error for RESTORE operation
at 18-JUN-1997 16:59:19.32
Enter a number equal to or greater than the next CSN and next TSN
values recorded in the database header:
$ RMU/RESTORE/ONLY_ROOT/SET_TSN=(TSN=274,CSN=274) -
_$ MF_PERSONNEL.RBF
Enter an RMU Dump command to see the next CSN and next TSN
values:
$ RMU/DUMP/HEADER=(SEQUENCE_NUMBERS) MF_PERSONNEL
.
.
.
Sequence Numbers...
- Transaction sequence number
Next number is 0:288
Group size is 0:32
- Commit sequence number
Next number is 0:288
Group size is 0:32
- Database bind sequence number
Next number is 0:288
Example 3
The following RMU Restore Only_Root command restores the database
root file from the database backup file (.rbf) to another device:
$ RMU/RESTORE/ONLY_ROOT/ROOT=DXXV9:[BIGLER.TESTING]MF_PERSONNEL -
_$ MF_PERSONNEL_BACKUP.RBF
The following DIRECTORY command confirms that the MF_
PERSONNEL.RDB file was restored in the specified directory:
$ DIRECTORY DXXV9:[BIGLER.TESTING]MF_PERSONNEL.RDB
Directory DXXV9:[BIGLER.TESTING]
MF_PERSONNEL.RDB;1 21-JAN-1991 14:37:36.87
Total of 1 file.
Example 4
Use the File=file-spec qualifier to update the .rdb file with a
storage area's new location. If you have moved a storage area to
a new location, use the File qualifier to show its new location
and the Snapshot qualifier to indicate the current version of
the area's snapshot (.snp) file. Enter the following RMU commands
to execute a series of operations that use the File and Snapshot
qualifiers in a restore-only-root operation to update the .rdb
file with new information since the database was last backed up.
Back up the database file:
$ RMU/BACKUP MF_PERSONNEL MFPERS_122.RBF.
Move the area to another directory:
$ RMU/MOVE_AREA MF_PERSONNEL JOBS -
_$ /FILE=[BIGLER.MFTEST.TEST1]JOBS.RDA
With the RMU Restore Only_Root command, give the area name, and
specify both the storage area file specification and its new
location. Also specify the snapshot (.snp) file with its correct
version. Note that .snp file version numbers increment with the
RMU Move_Area command.
$ RMU/RESTORE/ONLY_ROOT MFPERS_122.RBF JOBS -
_$ /FILE=[BIGLER.MFTEST.TEST1]JOBS.RDA -
_$ /SNAPSHOT=(FILE=[BIGLER.V41MFTEST]JOBS.SNP;2)
Display the .rdb file header and note that the file is correctly
updated.
The dump of the database root file lists these file
specifications:
$ RMU/DUMP/HEADER MF_PERSONNEL
DXXV9:[BIGLER.MFTEST.TEST1]JOBS.RDA;1
DXXV9:[BIGLER.MFTEST]JOBS.SNP;2
Verify the .rdb file to be certain that it has been properly
and completely updated relative to the files and their version
numbers that comprise the database.
$ RMU/VERIFY/ROOT MF_PERSONNEL
Example 5
The following command achieves the same results as the RMU
Restore Only_Root command in Example 4, but uses an options file
to specify the current location of the JOBS storage area and the
associated .snp file.
$ RMU/RESTORE/ONLY_ROOT MFPERS_122.RBF -
_$ JOBS/OPTIONS=OPTIONS_FILE.OPT
$ !
$ TYPE OPTIONS_FILE.OPT
JOBS /FILE=[BIGLER.V41MFTEST.TEST1]JOBS.RDA -
/SNAPSHOT=(FILE=BIGLER.V41MFTEST]JOBS.SNP)
Example 6
The following example demonstrates the use of the Noset_Tsn
qualifier and the Noupdate_Files qualifier to restore a database
using by-area backup files. In addition, it demonstrates the
automatic recovery feature of the RMU Restore command.
$ !
$ SET DEFAULT DISK1:[USER]
$ !
$ ! Create .aij files for the database. Because three .aij files are
$ ! created, fixed-size after-image journaling will be used.
$ !
$ RMU/SET AFTER_JOURNAL/ENABLE/RESERVE=4 -
_$ /ADD=(name=AIJ1, FILE=DISK2:[CORP]AIJ_ONE) -
_$ /ADD=(name=AIJ2, FILE=DISK2:[CORP]AIJ_TWO) -
_$ /ADD=(NAME=AIJ3, FILE=DISK2:[CORP]AIJ_THREE) -
_$ MF_PERSONNEL
%RMU-W-DOFULLBCK, full database backup should be done to
ensure future recovery
$ !
$ !
$ ! For the purposes of this example, assume the backup operation
$ ! recommended in the preceding warning message is done, but
$ ! that the time between this backup operation and the following
$ ! operations is several months so that this backup file is too
$ ! old to use in an efficient restore operation.
$ !
$ ! Update the DEPARTMENTS table.
$ !
$ SQL
SQL> ATTACH 'FILENAME MF_PERSONNEL';
SQL> --
SQL> -- On Monday, insert a new row in the DEPARTMENTS table. The
SQL> -- new row is stored in the DEPARTMENTS storage area.
SQL> --
SQL> INSERT INTO DEPARTMENTS
cont> (DEPARTMENT_CODE, DEPARTMENT_NAME, MANAGER_ID,
cont> BUDGET_PROJECTED, BUDGET_ACTUAL)
cont> VALUES ('WLNS', 'Wellness Center', '00188', 0, 0);
1 row inserted
SQL>
SQL> COMMIT;
SQL> DISCONNECT DEFAULT;
SQL> EXIT
$ !
$ ! Perform a by-area backup operation, including half of the
$ ! storage areas from the mf_personnel database.
$ !
$ RMU/BACKUP/INCLUDE=(RDB$SYSTEM, EMPIDS_LOW, EMPIDS_MID, -
_$ EMPIDS_OVER, DEPARTMENTS) MF_PERSONNEL -
_$ DISK3:[BACKUP]MONDAY_FULL.RBF
%RMU-I-NOTALLARE, Not all areas will be included in
this backup file
$ !
$ ! Update the SALARY_HISTORY table.
$ !
$ SQL
SQL> ATTACH 'FILENAME MF_PERSONNEL';
SQL> --
SQL> -- On Tuesday, one row is updated in the
SQL> -- SALARY_HISTORY storage area.
SQL> --
SQL> UPDATE SALARY_HISTORY
cont> SET SALARY_END ='20-JUL-1993 00:00:00.00'
cont> WHERE SALARY_START='14-JAN-1983 00:00:00.00'
cont> AND EMPLOYEE_ID = '00164';
1 row updated
SQL> COMMIT;
SQL> DISCONNECT DEFAULT;
SQL> EXIT
$ !
$ ! On Tuesday, back up the other half of the storage areas.
$ !
$ RMU/BACKUP/INCLUDE=(SALARY_HISTORY, JOBS, EMP_INFO, -
_$ MF_PERS_SEGSTR, RDB$SYSTEM) MF_PERSONNEL -
_$ DISK3:[BACKUP]TUESDAY_FULL.RBF
%RMU-I-NOTALLARE, Not all areas will be included in this
backup file
$ !
$ ! On Wednesday, perform additional updates.
$ !
$ SQL
SQL> ATTACH 'FILENAME MF_PERSONNEL';
SQL> --
SQL> -- Update another row in the SALARY_HISTORY table:
SQL> UPDATE SALARY_HISTORY
cont> SET SALARY_START ='23-SEP-1991 00:00:00.00'
cont> WHERE SALARY_START='21-SEP-1981 00:00:00.00'
cont> AND EMPLOYEE_ID = '00164';
1 row updated
SQL> COMMIT;
SQL> DISCONNECT DEFAULT;
SQL> EXIT
$ !
$ ! Assume the database is lost on Wednesday.
$ !
$ ! Restore the database root from the latest full-area backup file.
$ !
$ RMU/RESTORE/ONLY_ROOT/NOUPDATE_FILES/NOSET_TSN -
_$ DISK3:[BACKUP]TUESDAY_FULL.RBF/LOG
%RMU-I-AIJRSTBEG, restoring after-image journal "state" information
%RMU-I-AIJRSTJRN, restoring journal "AIJ1" information
%RMU-I-AIJRSTSEQ, journal sequence number is "0"
%RMU-I-AIJRSTSUC, journal "AIJ1" successfully restored from
file "DISK2:[CORP]AIJ_ONE.AIJ;1"
%RMU-I-AIJRSTJRN, restoring journal "AIJ2" information
%RMU-I-AIJRSTNMD, journal has not yet been modified
%RMU-I-AIJRSTSUC, journal "AIJ2" successfully restored from
file "DISK2:[CORP]AIJ_TWO.AIJ;1"
%RMU-I-AIJRSTJRN, restoring journal "AIJ3" information
%RMU-I-AIJRSTNMD, journal has not yet been modified
%RMU-I-AIJRSTSUC, journal "AIJ3" successfully restored from
file "DISK2:[CORP]AIJ_THREE.AIJ;1"
%RMU-I-AIJRSTEND, after-image journal "state" restoration complete
%RMU-I-RESTXT_00, Restored root file
DISK1:[USER]MF_PERSONNEL.RDB;1
%RMU-I-AIJRECBEG, recovering after-image journal "state" information
%RMU-I-AIJRSTAVL, 3 after-image journals available for use
%RMU-I-AIJRSTMOD, 1 after-image journal marked as "modified"
%RMU-I-LOGMODSTR, activated after-image journal "AIJ2"
%RMU-I-AIJISON, after-image journaling has been enabled
%RMU-W-DOFULLBCK, full database backup should be done to
ensure future recovery
%RMU-I-AIJRECEND, after-image journal "state" recovery complete
$ !
$ ! Restore the database areas, starting with the most recent
$ ! full-area backup file. (If the RDB$SYSTEM area is not in the
$ ! most recent full-area backup file, however, it must be restored
$ ! first.) Do not restore any area more than once.
$ !
$ ! Specify the Norecovery qualifier since there are additional
$ ! backup files to apply.
$ !
$ RMU/RESTORE/AREA/NOCDD/NORECOVER -
_$ DISK3:[BACKUP]TUESDAY_FULL.RBF -
_$ RDB$SYSTEM, SALARY_HISTORY, JOBS, -
_$ EMP_INFO, MF_PERS_SEGSTR/LOG
%RMU-I-RESTXT_21, Starting full restore of storage area
DISK1:[USER]MF_PERS_DEFAULT.RDA;1 at 18-JUN-1997 16:14:40.88
%RMU-I-RESTXT_21, Starting full restore of storage area
DISK1:[USER]SALARY_HISTORY.RDA;1 at 18-JUN-1997 16:14:41.28
%RMU-I-RESTXT_21, Starting full restore of storage area
DISK1:[USER]JOBS.RDA;1 at 18-JUN-1997 16:14:41.83
%RMU-I-RESTXT_21, Starting full restore of storage area
DISK1:[USER]EMP_INFO.RDA;1 at 18-JUN-1997 16:14:42.06
%RMU-I-RESTXT_21, Starting full restore of storage area
DISK1:[USER]MF_PERS_SEGSTR.RDA;1 at 18-JUN-1997 16:14:42.27
%RMU-I-RESTXT_24, Completed full restore of storage area
DISK1:[USER]JOBS.RDA;1 at 18-JUN-1997 16:14:42.49
%RMU-I-RESTXT_24, Completed full restore of storage area
DISK1:[USER]EMP_INFO.RDA;1 at 18-JUN-1997 16:14:42.74
.
.
.
%RMU-I-RESTXT_01, Initialized snapshot file
DISK1:[USER]MF_PERS_DEFAULT.SNP;1
%RMU-I-LOGINIFIL, contains 100 pages, each page
is 2 blocks long
%RMU-I-RESTXT_01, Initialized snapshot file
DISK1:[USER]EMP_INFO.SNP;1
%RMU-I-LOGINIFIL, contains 100 pages, each page
is 2 blocks long
.
.
.
%RMU-I-AIJWASON, AIJ journaling was active when
the database was backed up
%RMU-I-AIJRECFUL, Recovery of the entire database
starts with AIJ file sequence 0
%RMU-I-COMPLETED, RESTORE operation completed
at 18-JUN-1997 16:14:46.82
$ !
$ ! Complete restoring database areas by applying the most
$ ! recent full-area backup file. However, do not include
$ ! the RDB$SYSTEM table because that was already restored
$ ! in the previous restore operation. This restore
$ ! operation will attempt an automatic recovery of the .aij files.
$ !
$ RMU/RESTORE/AREA/NOCDD DISK3:[BACKUP]MONDAY_FULL.RBF -
_$ EMPIDS_LOW, EMPIDS_MID, EMPIDS_OVER, DEPARTMENTS/LOG
%RMU-I-RESTXT_21, Starting full restore of storage area
DISK1:[USER]EMPIDS_OVER.RDA;1 at 18-JUN-1997 16:20:05.08
%RMU-I-RESTXT_21, Starting full restore of storage area
DISK1:[USER]EMPIDS_MID.RDA;1 at 18-JUN-1997 16:20:05.40
%RMU-I-RESTXT_21, Starting full restore of storage area
DISK1:[USER]EMPIDS_LOW.RDA;1 at 18-JUN-1997 16:20:05.91
%RMU-I-RESTXT_21, Starting full restore of storage area
DISK1:[USER]DEPARTMENTS.RDA;1 at 18-JUN-1997 16:20:06.01
%RMU-I-RESTXT_24, Completed full restore of storage area
DISK1:[USER]EMPIDS_OVER.RDA;1 at 18-JUN-1997 16:20:06.24
.
.
.
%RMU-I-RESTXT_01, Initialized snapshot file
DISK1:[USER]DEPARTMENTS.SNP;1
%RMU-I-LOGINIFIL, contains 100 pages, each page
is 2 blocks long
%RMU-I-RESTXT_01, Initialized snapshot file
DISK1:[USER]EMPIDS_LOW.SNP;1
%RMU-I-LOGINIFIL, contains 100 pages, each page
is 2 blocks long
.
.
.
%RMU-I-AIJWASON, AIJ journaling was active when
the database was backed up
%RMU-I-AIJRECFUL, Recovery of the entire database
starts with AIJ file sequence 0
%RMU-I-AIJRECARE, Recovery of area DEPARTMENTS starts
with AIJ file sequence 0
%RMU-I-AIJRECARE, Recovery of area EMPIDS_LOW starts
with AIJ file sequence 0
%RMU-I-AIJRECARE, Recovery of area EMPIDS_MID starts
with AIJ file sequence 0
%RMU-I-AIJRECARE, Recovery of area EMPIDS_OVER starts
with AIJ file sequence 0
%RMU-I-AIJBADAREA, inconsistent storage area
DISK1:[USER]DEPARTMENTS.RDA;1 needs AIJ sequence number 0
%RMU-I-AIJBADAREA, inconsistent storage area
DISK1:[USER]EMPIDS_LOW.RDA;1 needs AIJ sequence number 0
.
.
.
%RMU-I-LOGRECDB, recovering database file
DISK1:[USER]MF_PERSONNEL.RDB;1
%RMU-I-AIJAUTOREC, starting automatic after-image
journal recovery
%RMU-I-LOGOPNAIJ, opened journal file DISK2:[CORP]AIJ_ONE.AIJ;1
%RMU-I-AIJONEDONE, AIJ file sequence 0 roll-forward
operations completed
%RMU-I-LOGRECOVR, 1 transaction committed
%RMU-I-LOGRECOVR, 0 transactions rolled back
%RMU-I-LOGRECOVR, 2 transactions ignored
%RMU-I-AIJNOACTIVE, there are no active transactions
%RMU-I-AIJSUCCES, database recovery completed successfully
%RMU-I-AIJALLDONE, after-image journal roll-forward
operations completed
%RMU-I-LOGSUMMARY, total 1 transaction committed
%RMU-I-LOGSUMMARY, total 0 transactions rolled back
%RMU-I-LOGSUMMARY, total 2 transactions ignored
%RMU-I-AIJSUCCES, database recovery completed successfully
%RMU-I-AIJGOODAREA, storage area
DISK1:[USER]DEPARTMENTS.RDA;1 is now consistent
%RMU-I-AIJGOODAREA, storage area
DISK1:[USER]EMPIDS_LOW.RDA;1 is now consistent
%RMU-I-AIJGOODAREA, storage area
DISK1:[USER]EMPIDS_MID.RDA;1 is now consistent
.
.
.
%RMU-I-AIJFNLSEQ, to start another AIJ file recovery,
the sequence number needed will be 0
%RMU-I-COMPLETED, RESTORE operation completed at
18-JUN-1997 16:20:11.45
$ !
$ ! The database is now restored and recovered. However, if
$ ! for some reason the automatic .aij file recovery was not
$ ! possible (for example, if you had backed up the .aij files),
$ ! apply the .aij files in the same order in
$ ! which they were created. That is, if .aij files were backed
$ ! up each night, apply aij_mon.aij first and aij_tues.aij second.
Example 7
The following example demonstrates the use of the Directory,
File, and Root qualifiers. First, the database is backed up, then
a couple storage area files and a snapshot file are moved. The
restore-only-root operation does the following:
o The default directory is specified as DISK2:[DIR].
o The target directory and file name for the database root file
is specified with the Root qualifier. The target directory
specified with the Root qualifier overrides the default
directory specified with the Directory qualifier. Thus, the
RMU Restore Only_Root process restores the database root in
DISK3:[ROOT] and names it COPYRDB.RDB.
o The target directory for the EMPIDS_MID storage area is
DISK4:[FILE]. The RMU Restore Only_Root process updates the
database root file to indicate that EMPIDS_MID currently
resides in DISK4:[FILE].
o The target for the EMPIDS_MID snapshot file is
DISK5:[SNAP]EMPIDS_MID.SNP Thus, the RMU Restore Only_
Root process updates the database root file to indicate
that the EMPIDS_MID snapshot file currently resides in
DISK5:[SNAP]EMPIDS_MID.SNP.
o The target file name for the EMPIDS_LOW storage area is
EMPIDS. Thus, the RMU Restore Only_Root process updates
the database root file to indicate that the EMPIDS_LOW
storage area currently resides in the DISK2 default directory
(specified with the Directory qualifier), and the file is
currently named EMPIDS.RDA.
o The target for the EMPIDS_LOW snapshot file is
DISK5:[SNAP]EMPIDS.SNP. Thus, the RMU Restore Only_
Root process updates the database root file to indicate
that the EMPIDS_LOW snapshot file currently resides in
DISK5:[SNAP]EMPIDS.SNP.
o Data for all the other storage area files and snapshot files
remain unchanged in the database root file.
$ ! Back up the database:
$ !
$ RMU/BACKUP MF_PERSONNEL.RDB MF_PERSONNEL.RBF
$ !
$ ! Move a couple of storage areas and a snapshot file:
$ !
$ RMU/MOVE_AREA MF_PERSONNEL.RDB -
_$ /DIRECTORY=DISK2:[DIR] -
_$ EMPIDS_MID/FILE=DISK4:[FILE] -
_$ /SNAPSHOT=(FILE=DISK3:[SNAP]EMPIDS_MID.SNP), -
_$ EMPIDS_LOW/FILE=EMPIDS -
_$ /SNAPSHOT=(FILE=DISK5:[SNAP]EMPIDS.SNP)
$ !
$ ! Database root is lost. Restore the root and update the
$ ! locations of the moved storage areas and snapshot file as
$ ! recorded in the database root file because the locations
$ ! recorded in the backup file from which the root is restored
$ ! are not up-to-date:
$ !
$ RMU/RESTORE/ONLY_ROOT MF_PERSONNEL.RBF -
_$ /ROOT=DISK3:[ROOT]MF_PERSONNEL.RDB -
_$ EMPIDS_MID/FILE=DISK4:[FILE] -
_$ /SNAPSHOT=(FILE=DISK2:[DIR]EMPIDS_MID.SNP), -
_$ EMPIDS_LOW/FILE=DISK2:[DIR]EMPIDS -
_$ /SNAPSHOT=(FILE=DISK5:[SNAP]EMPIDS.SNP)