Deferring the restore of dependent objects

You can defer the restore processing for some objects that depend on related objects when the related objects are not available.

Database logical files, indexes, and SQL materialized query tables (MQTs) depend on other files for their information. Objects that are journaled depend on journal objects to record changes. When objects are in the same library as the objects they depend on, the Save Library (SAVLIB) and Restore Library (RSTLIB) commands save and restore the objects in the correct order. The dependent objects are saved and restored after the objects that they depend on.

When objects depend on objects in other libraries, or if you do not save and restore entire libraries, you might attempt to restore dependent objects before the objects that they depend on. Logical files, indexes, and MQTs cannot be restored when the files that they depend on do not exist. Objects cannot start journaling when the journals do not exist. However, you can defer the processing that is needed to restore these objects and start journaling by specifying the Defer ID (DFRID) parameter on the Restore Library (RSTLIB) or Restore Object (RSTOBJ) command. When you specify a defer ID, the system stores the information that is needed to complete the restore and start journaling. The information is stored in files in library QRECOVERY or QRCYxxxxx, where xxxxx is the number of an independent auxiliary storage pool. The information is available later when the related files and journals are available.

When the related files and journals are available, use the Restore Deferred Objects (RSTDFROBJ) command with the same defer ID to complete the restore and start journaling for the dependent objects. If you restore the related files with the same defer ID, the system automatically attempts to complete the restore of the deferred files; you do not need to use the RSTDFROBJ command in this case.

When you use the Restore Library (RSTLIB) command to restore all libraries (*NONSYS), all user libraries (*ALLUSR), or IBM-supplied libraries (*IBM), QRSTLIB is the default DFRID parameter value. These RSTLIB operations automatically perform the RSTDFROBJ operation after the libraries are restored. Therefore, these RSTLIB operations automatically handle dependent objects that are restored in the wrong sequence. For other restore operations, you must specify a defer ID to manage dependent objects.

If you use IBM® Backup, Recovery and Media Services for i (BRMS), Q1ARSTID is the default defer ID value for all recovery operations.

Some types of deferred objects are created during the initial restore operation. Other types of deferred objects are not created. A deferred logical file does not exist on the system. A deferred MQT exists on the system, but you cannot perform functions on the MQT that require access to the based-on files. A deferred object that is journaled exists on the system, but journaling is not started.

When your data recovery is complete and you no longer need the information that is stored for deferred objects, use the Remove Defer ID (RMVDFRID) command to remove the information. For example, use the RMVDFRID command if you manually create the deferred objects or start journaling for the deferred objects. Information that is no longer needed might cause future restore operations to send messages that you do not expect.

Note: You can run multiple restore operations concurrently with the same defer ID. Wait until all the restore operations are complete before you run the RSTDFROBJ and the RMVDFRID commands. Running the RSTDFROBJ command while restore operations are still running might cause extra processing. Running the RMVDFRID command while restore operations are still running might remove information too soon.

Deferred restore examples

This command restores all the saved nonsystem libraries to the system from tape. The printout lists all the objects that were deferred, and a final completion message states how many libraries were restored and how many were not restored. In this example, the system uses the special defer ID value of QRSTLIB so that dependent files that are restored before their dependencies in another library are restored, are deferred. The system attempts to automatically restore the deferred files when the based-on files are finally restored.

RSTLIB SAVLIB(*NONSYS) DEV(TAP01) OUTPUT(*PRINT) DFRID(*DFT)

This example shows libraries that were saved in alphabetical order being restored. Library LFLIB contains files that have based-on files in library PFLIB. The files in LFLIB cannot be restored until after the files in PFLIB are restored. A defer ID is specified, so the files in LFLIB are deferred. Use the RSTDFROBJ command to complete the restore operation of these files. If you had not specified a defer ID on the command, you would have had to rewind or reload the tape to restore the files in LFLIB.


(Restore libraries before LFLIB.)
RSTLIB SAVLIB(LFLIB) DEV(TAPE01) ENDOPT(*LEAVE) DFRID(ABC)
(Restore libraries between LFLIB and PFLIB.)
RSTLIB SAVLIB(PFLIB) DEV(TAPE01) ENDOPT(*LEAVE) DFRID(ABC)
(Restore libraries after PFLIB).
RSTDFROBJ DFRID(ABC)

The RMVDFRID command removes any remaining information about objects that were deferred during the restore operation.

RMVDFRID DFRID(ABC)