Restoring objects in directories
You can use the Restore Object (RST) command to restore objects that you have saved with the Save Object (SAV) command.
These commands are most commonly used to save and restore objects
root file system, the QOpenSys file system, and the QNTC
- If you have related objects, such as journals and journaled objects, you must ensure that you restore them in the correct sequence.
- If you are restoring to a different system or different logical partitions, specify ALWOBJDIF(*ALL) when you are restoring directories.
You can use the RST command to restore the following items:
- A specific object
- A directory or subdirectory
- An entire file system
- Objects that meet search criteria
- A list of object path names
You can also restore the items in the preceding list by using the Restore Object (QsrRestore) API.
RST DEV('/QSYS.LIB/media-device-name.DEVD') OBJ(('/*') ('/QSYS.LIB' *OMIT) ('/QDLS' *OMIT))
- Tape file sequence number.
The tape file sequence number is the quickest way to locate the tape file that contains the desired objects.
- Starting position.
The starting position within the tape file for each object is provided by save operations when output to a streamfile or user space is requested.
RST DEV('/QSYS.LIB/NET3590.DEVD') OBJ(('/JS200000/FXX')) VOL(LN4381) ENDOPT(*LEAVE) SEQNBR(4488) POSITION(000000000001904900000000000019CAA)
You can rename an object or restore it to a different directory by using the new-name element of the object (OBJ) parameter.
The OBJ parameter on the RST command supports the use of wildcard characters and the directory hierarchy. When you have a specific subset of similar objects within a directory subtree that you want to restore, you can use the Name pattern (PATTERN) parameter to further define the objects that are identified in the (OBJ) parameter.
Some file systems allow you to name the same physical object different ways by using aliases and links. For examples of objects with links and how those objects are saved, see the Backing up your system topic.
In the example of Figure 1, FILEA in the JCHDIR directory and FILEB in the DRHDIR directory are both hard links to the same file. They point to the same object. They can have the same name or different names for the objects.
Table 1 shows several
examples of how the system restores these objects. These examples
assume that you use this SAV command:
The media volume contains OBJECT A and both hard links that point
to the object.
|Object parameter on RST command||Objects that are on the system before the RST command||Objects after the RST command|
||JCHDIR/FILEA||The saved data is restored. The object DRHDIR/FILEB is created on the system. It points to the same object as JCHDIR/FILEA.|
||JCHDIR/FILEA||A new object, DRHDIR/FILEB, is created. The JCHDIR/FILEA that exists on the system is not affected by the restore operation.|
||JCHDIR/FILEA, DRHDIR/FILEB||Data from the media copy of FILEA and FILEB is restored over the system copy because the same name is specified as a name that already exists on the system.|
||CRTPRNDIR||If parent directories of objects being restored do not exist, the CRTPRNDIR command specifies if they should be created.|
||PRNDIROWN||The PRNDIROWN command specifies the name of an existing user profile that will own parent directories created by the restore operation.|
Figure 2 shows the symbolic
customer that points in the CUSTLIB
If you restore the customer object (
you are restoring only the fact that it points to the CUSTMAS file,
not the file itself. If the CUSTMAS file does not exist, the restore
operation succeeds. However, if you try to use the customer object,
you receive an error message. If you restore the CUSTMAS file or create
it again, the symbolic link between customer and the CUSTMAS file