You can recover a Db2 subsystem
and data sharing group to a prior point in time by using the BACKUP
SYSTEM and RESTORE SYSTEM utilities.
About this task
In this recovery procedure, you create and populate a
table that contains data that is both valid and invalid. You need
to restore your Db2 subsystem
to a point in time before the invalid data was inserted into the table,
but after the point in time when the valid data was inserted. Also,
you create an additional table space and table that Db2 will re-create during the log-apply phase
of the restore process.
Procedure
To insert data into a table, determine the point in time that you want to recover to,
and then recover the Db2 subsystem to a
prior point in time:
- Issue the START DB2 command to start Db2 and all quiesced members of
the data sharing group.
Quiesced members are ones that
you removed from the data sharing group either temporarily or permanently.
Quiesced members remain dormant until you restart them.
- Issue SQL statements to create a database, a table space,
and two tables with one index for each table.
- Issue the BACKUP SYSTEM DATA ONLY utility control statement
to create a backup copy of only the database copy pool for a Db2 subsystem or data sharing group.
- Issue an SQL statement to first insert rows into one of
the tables, and then update some of the rows.
- Use the LOAD utility with the LOG NO attribute to load
the second table.
- Issue SQL statements to create an additional
table space, table, and index in an existing database.
Db2 will re-create the additional
table space and table during the log-apply phase of the restore process.
- Issue the SET LOG SUSPEND command or the SET LOG RESUME
command to obtain a log truncation point, logpoint1,
which is the point you want to recover to.
For a non-data
sharing group, use the RBA value. For a data sharing group, use the
lowest log record sequence number (LRSN) from the active members.
The following example shows sample output for the SET LOG SUSPEND
command:
14.21.49 -db2aset log suspend
14.21.49 STC00059 DSN9022I -DB2A DSNJC001 '-SET LOG' NORMAL COMPLETION
14.21.50 STC00059 *DSNJ372I -DB2A DSNJC09A UPDATE ACTIVITY HAS BEEN
SUSPENDED FOR DB2A AT RBA 00000000000028B5588C, LRSN
00CA2981028F3D000000, PRIOR CHECKPOINT RBA 00000000000028B52667
- Issue an SQL statement to first insert rows into one of
the tables and then to update and delete some rows.
- Issue the STOP DB2 command to stop Db2 and all active members of the
data sharing group.
- Run the DSNJU003 change log inventory utility to create
a SYSPITR CRCR record (
CRESTART CREATE SYSPITR=logpoint1
).
The log truncation point is the value that you obtained from
issuing either the SET LOG SUSPEND command, or
the SET LOG RESUME command.
- For a data sharing group, delete all of the coupling facility
structures.
- Issue the START DB2 command to restart Db2 and all members of the data
sharing group.
- Run the RESTORE SYSTEM utility.
For a data sharing
group, this utility can be run only on one member. If the utility
stops and you must restart it, you can restart the utility only on
the member on which it was initially run.
- After the RESTORE SYSTEM utility completes successfully,
issue the STOP DB2 command to stop Db2 and all active members of the data sharing
group.
The Db2 subsystem
resets to RECOVER-pending status.
- Issue the START DB2 command to restart Db2 and all members of the data
sharing group.
- Issue the DISPLAY command to identify
the utilities that are active and the objects that are restricted.
For example:
-DIS UTIL(*)
-DIS DB(DSNDB01) SP(*)
-DIS DB(DSNDB06) SP(*) LIMIT(*)
-DIS DB(DSNDB06) SP(*) LIMIT(*)RESTRICT
- Stop all of the active utilities that you identified in
the previous step.
- Recover any objects that are in RECOVER-pending status
or REBUILD-pending status from the table that you created in step 6.