Deferring the restore of dependent objects
You can defer the restore of database logical files, indexes, and SQL materialized query tables (MQTs), that have dependencies on other files.
In previous releases before V6R1, restoring files that resided in a different library than the based-on files was difficult to manage. If the library with a logical file was restored before the library with the underlying physical file, the logical file did not restore. To restore the logical file, you needed to attempt to restore from the media one or more times after restoring the physical file. Materialized query tables (MQTs) are physical files that have dependencies on based-on files. A MQT cannot be restored if one of its based-on files was missing.
You can now defer the restore of logical files and MQTs whose based-on files or members are missing. A deferred logical file is cached and restored from the cache after its based-on files are available. A deferred MQT is created, so that its data spaces can be restored from the media on the first pass. By deferring the restore of logical files and MQTs until the based-on files become available, you can complete the restore operation in one pass through the media, which saves time.
To defer a restore of database files whose based-on files are missing, specify the Defer ID (DFRID) parameter on the Restore Library (RSTLIB) or Restore Object (RSTOBJ) command. Specifying the same defer ID for multiple restore operations provides an association between the set of deferred files.
When the based-on files become available, use the Restore Deferred Objects (RSTDFROBJ) command with the same defer ID to complete the restore of deferred objects if the based-on files are available. If you restore the missing based-on files with the same defer ID that you used for the dependent, deferred files, the system automatically attempts to complete the restore of the deferred files at that time.
Deferred objects can be logical files or MQTs. A deferred logical file is not created until the restore operation is complete. A deferred MQT is created, but until the restore operation is complete, you cannot perform functions on the MQT that require access to the based-on files.
After the deferred restore operation completes, use the Remove Defer ID (RMVDFRID) command to remove information about a deferred file from the cache. Use the RMVDFRID command if you have created or restored a file with the same name using a different defer ID or no defer ID.
- Specify the *NONSYS, *ALLUSR, or *IBM values for the Saved Library (SAVLIB) parameter.
- Specify *DFT for the DFRID parameter or omit the DFRID parameter.
In this case, the system manages the deferred files. In all other cases, if you omit the DFRID parameter, you need to manage the dependent database files.
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 information about objects that were deferred during the restore operation.
RMVDFRID DFRID(ABC)