Command reference / save

RST

Restore Object

The Restore (RST) command restores a copy of one or more objects that can be used in the integrated file system. For more information about integrated file system commands, see the Integrated file system topic collection in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.

Allowed environments: *ALL. Positional parameters: 2.

Restrictions

Parameters

DEV Dev

Specifies the device from which the objects are restored. For more information on specifying device path names, refer to "Specifying the device name" in the Backup and recovery topic collection in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/. This is a required parameter. Note: This parameter is Unicode-enabled. See "Unicode support in CL" in the CL topic collection in the Programming category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/ for additional information.

Type
*PNAME
Required
Yes
Length
5000
List limit
4
Case
Mixed case
'save-file-path-name'
Specify the path name of the save file used to restore the objects.
'optical-device-path-name'
Specify the path name of the optical device used to restore the objects.
'tape-media-library-device-path-name'
Specify the path name of the tape media library used to restore the objects.
'tape-device-path-name'
Specify the path name of the tape device used to restore the objects. A maximum of four tape devices can be specified. If a virtual tape device is used, it must be the only device specified.
'media-definition-path-name'
Specify the path name of the media definition (*MEDDFN) object that identifies the devices and media used to restore the data. For information about creating a media definition, see the Create Media Definition API in the APIs topic collection in the Programming category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/. For information about using a media definition, see the Recovering your system book, SC41-5304 and the Back up your server topic in the Backup and recovery topic collection in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.

OBJ Objects

Specifies the path name of the object to restore. You can specify a pattern for this path name. A maximum of 300 path names can be specified. For more information on specifying path names, refer to "Object naming rules" in the CL topic collection in the Programming category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/. Additional information about object name patterns is in the Integrated file system topic collection in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/. Note: This parameter is Unicode-enabled. See "Unicode support in CL" in the CL topic collection in the Programming category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/ for additional information. Specifies the objects saved on the media. Directory abbreviations (for example, the current directory) are expanded with their current values, not the values they had at the time of the save operation. Specifies whether names that match the pattern should be included or omitted from the operation. Note that in determining whether a name matches a pattern, relative name patterns are always treated as relative to the current working directory. Note: The SUBTREE parameter determines whether the subtrees are included or omitted. Specifies the new path name of the object.

Type
*ELEM
Required
No
Default
(*)
List limit
300
Case
Uppercase
'*'
The objects in the current directory are restored.
Element 1: Name: path-name
Specify an object path name or a pattern that can match many names. If *SAME is specified for the third element of this parameter, each component in the path name must exist with the exception of the last component. The object name in the last component is restored as new if it doesn't exist.
*INCLUDE
The objects that match the object name pattern are to be restored, unless overridden by an *OMIT specification.
*OMIT
The objects that match the object name pattern are not to be restored. This overrides an *INCLUDE specification and is intended to be used to omit a subset of a previously selected pattern.
*SAME
The objects are to be restored with the same names they had when they were saved.
Element 3: New object name: path-name
Specify the path name with which to restore the object. If a pattern is specified in the first element, the new path name must be the directory into which to restore any objects that match the pattern. If an object name is specified in element 1, each component in the new path name must exist with the exception of the last component. If the object described in the last component doesn't exist, it will be restored as new.
Elements in order

Element Element

Type
*PNAME
Required
Yes
Length
5000
Case
Mixed case

Element Element

Type
*CHAR
Required
No
Default
*INCLUDE
Length
8
Case
Uppercase

Allowed values: *INCLUDE, *OMIT

Element Element

Type
*PNAME
Required
No
Default
*SAME
Length
5000
Case
Mixed case

Suggested / special values: *SAME

SUBTREE Subtree

Specifies whether directory subtrees are included in the restore operation.

Type
*CHAR
Required
No
Default
*ALL
Length
5
Case
Uppercase

Allowed values: *ALL, *DIR, *NONE, *OBJ, *STG

*ALL
The entire subtree of each directory that matches the object name pattern is processed. The subtree includes all subdirectories and the objects within those subdirectories.
*DIR
The objects in the first level of each directory that matches the object name pattern are processed. The subdirectories of each matching directory are included, but the objects in the subdirectories are not included.
*NONE
No subtrees are included in the restore operation. If a directory matches the object name pattern specified, the objects in the directory are included. If the directory has subdirectories, neither the subdirectories nor the objects in the subdirectories are included.
*OBJ
Only the objects that match the object name pattern will be processed. If the object name pattern specifies a directory, objects in the directory are not included.
*STG
The objects that match the object name pattern are processed along with the storage for related objects. Objects can only be restored using this value if they were saved with SUBTREE(*STG).

VOL Vol

Specifies the volume identifiers of the media or the cartridge identifiers of tapes in a tape media library device, from which the objects are being restored. The volumes must be in the same order as they were when the data was saved. The volume that contains the beginning of the file to be restored should be placed in the device. Note: The version of the object that is restored is the first version found in the specified location, unless a specific version is identified by the values on the SAVDATE and SAVTIME parameters.

Type
*CHAR
Required
No
Default
*MOUNTED
Length
6
List limit
75
Case
Uppercase

Suggested / special values: *MOUNTED

*MOUNTED
The objects are restored from the volumes placed in the device specified for the Device (DEV) parameter. For a media library device, the volume to be used is the next cartridge in the category mounted by the Set Tape Category (SETTAPCGY) command. Note: This value cannot be specified when using an optical media library device.
character-value
Specify the identifiers of one or more volumes in the order in which they are placed in a device and used to restore the data.

LABEL Label

Specifies the file identifier of the media to be used for the restore operation.

Type
*CHAR
Required
No
Default
*SEARCH
Length
17
Case
Uppercase

Suggested / special values: *SEARCH

*SEARCH
The file label for which to search is determined by the system.
character-value
Specify the identifier (up to 17 characters) of the tape file to be used for the restore operation.

SEQNBR Seqnbr

Specifies the tape file sequence number to be used.

Type
*UINT4
Required
No
Default
*SEARCH
Range
1 to 16777215
Case
Uppercase

Suggested / special values: *SEARCH

*SEARCH
The tape volume is searched for the next file that contains any of the specified objects.
1-16777215
Specify the sequence number of the file.

ENDOPT Endopt

Specifies the operation that is automatically done on the tape or optical volume after the restore operation ends. If more than one volume is used, this parameter applies only to the last volume used; all other volumes are unloaded when the end of the volume is reached. Note: This parameter is valid only if a tape or optical device name is specified for the DEV parameter. For optical devices, *UNLOAD is the only special value supported, *REWIND and *LEAVE will be ignored.

Type
*CHAR
Required
No
Default
*REWIND
Length
7
Case
Uppercase

Allowed values: *REWIND, *LEAVE, *UNLOAD

*REWIND
The tape is automatically rewound, but not unloaded, after the operation has ended.
*LEAVE
The tape does not rewind or unload after the operation ends. It remains at the current position on the tape drive.
*UNLOAD
The tape is automatically rewound and unloaded after the operation ends. Some optical devices will eject the volume after the operation ends.

OPTION Option

Specifies whether to restore objects that already exist on the system or objects that do not already exist on the system.

Type
*CHAR
Required
No
Default
*ALL
Length
4
Case
Uppercase

Allowed values: *ALL, *NEW, *OLD

*ALL
All of the specified objects are restored, whether they already exist on the system or not.
*NEW
Objects are restored only if they do not already exist on the system.
*OLD
Objects are restored only if they already exist on the system.

CRTPRNDIR Crtprndir

Specifies whether parent directories of objects being restored should be created if they do not exist. For example, if object '/a/b/c/file1' is being restored then directories '/a', '/a/b' and '/a/b/c' must exist. This parameter only applies to "root" (/), QOpenSys and user-defined file systems, and will be ignored for all other file systems.

Type
*CHAR
Required
No
Default
*NO
Length
4
Case
Uppercase

Allowed values: *NO, *YES

*NO
Parent directories will not be created if they do not exist. Diagnostic message CPD375B will be sent and the object will not be restored.
*YES
The restore will create parent directories if they do not exist. The directories created by the restore will have *EXCLUDE public authority and will be owned by the user profile specified for the Parent directory owner (PRNDIROWN) parameter. The other parent directory attributes will be set using the shipped default values for the Create Directory (CRTDIR) command parameters.

ALWOBJDIF Alwobjdif

Specifies whether differences are allowed between the saved objects and the restored objects. You must have all object (*ALLOBJ) special authority to specify any value other than *NONE for this parameter. If differences are found, the final message for the restore operation is an escape message rather than the normal completion message. The types of differences include: Authorization list: The saved object had an authorization list, and either the object exists on the system but does not have the same authorization list, or the object does not exist and it is being restored to a different system than the save system. Note: This parameter has no effect when the saved object did not have an authorization list. If the object exists, it is restored with the authorization list of the existing object. If it does not exist, it is restored with no authorization list. Ownership: The owner of an object on the system is different than the owner of an object from the save operation. Primary Group: The primary group of an object on the system is different than the primary group of an object from the save operation.

Type
*CHAR
Required
No
Default
*NONE
Length
6
List limit
3
Case
Uppercase

Suggested / special values: *NONE, *ALL, *AUTL, *OWNER, *PGP

*NONE
None of the differences listed above are allowed on the restore operation. See the description of each individual value to determine how differences are handled.
*ALL
All of the differences listed above are allowed on the restore operation. See the description of each individual value to determine how differences are handled.
*AUTL
Authorization list differences are allowed. If the saved object had an authorization list and the object exists on the system but does not have the same authorization list, the object is restored with the authorization list of the existing object. If the saved object had an authorization list and the object does not exist and it is being restored to a different system than the save system, the object is restored and it is linked to the authorization list. If the authorization list does not exist, the public authority is set to *EXCLUDE. If this value is not specified, authorization list differences are not allowed. If the saved object had an authorization list and the object exists on the system but does not have the same authorization list, the object is not restored. If the saved object had an authorization list and the object does not exist and it is being restored to a different system than the save system, the object is restored, but it is not linked to the authorization list, and the public authority is set to *EXCLUDE.
*OWNER
Ownership differences are allowed. If an object already exists on the system with a different owner than the saved object, the object is restored with the owner of the object on the system. If this value is not specified, ownership differences are not allowed. If an object already exists on the system with a different owner than the saved object, the object is not restored.
*PGP
Primary group differences are allowed. If an object already exists on the system with a different primary group than the saved object, the object is restored with the primary group of the object on the system. If this value is not specified, primary group differences are not allowed. If an object already exists on the system with a different primary group than the saved object, the object is not restored.

PVTAUT Private authorities

Specifies whether to restore private authorities with the objects that are restored.

Type
*CHAR
Required
No
Default
*NO
Length
4
Case
Uppercase

Allowed values: *NO, *YES

*NO
No private authorities are restored.
*YES
Private authorities are restored with the objects. Objects will be restored only from save operations that specified that private authorities should be saved with the objects. Note: You must have all object (*ALLOBJ) special authority to specify this value.

Examples

RST DEV('/QSYS.LIB/TAP01.DEVD') OBJ(('/*') ('/QSYS.LIB' *OMIT) ('/QDLS' *OMIT))

Restoring All Data Not in Libraries or Document Library Objects. This command restores all objects that are not in libraries and are not document library objects.

RST DEV('/QSYS.LIB/TAP01.DEVD') OBJ('/QSYS.LIB/A.LIB')

Restoring a Library. This command restores the library A from the tape device named TAP01.

RST DEV('/QSYS.LIB/TAP01.DEVD') OBJ('/QSYS.LIB/MYLIB.LIB/*.FILE')

Restoring All Files in MYLIB. This command restores all files in the library MYLIB from the tape device named TAP01.

RST DEV('/QSYS.LIB/TAP01.DEVD')

Restoring All Objects in the Current Directory. This command uses the default value on the OBJ parameter to restore all objects in the current directory and its subdirectories.

RST DEV('/QSYS.LIB/TAP01.DEVD') OBJ('*') SUBTREE(*NONE)

This command restores all objects in the current directory but not in subdirectories.

RST DEV('/QSYS.LIB/TAP01.DEVD') OBJ('.') SUBTREE(*DIR)

This command restores the current directory and all of the objects in the current directory. It does not restore objects in the subdirectories of the current directory.

RST DEV('/QSYS.LIB/TAP01.DEVD') OBJ(('*') ('**.BACKUP' *OMIT) ('**.TEMP' *OMIT))

Omitting Objects. This command restores all objects in the current directory except those with extensions of .BACKUP and .TEMP (the entire subtrees of directories with these extensions are omitted).

RST DEV('/QSYS.LIB/TAP01.DEVD') OBJ(('MYDIR/X.PGM' *INCLUDE 'YOURDIR/Y.PGM'))

Renaming or Moving Objects. This command restores the program X from the directory MYDIR as the program Y in the directory YOURDIR.

RST DEV('/QSYS.LIB/TAP01.DEVD') OBJ(('MYDIR/*.PGM' *INCLUDE 'YOURDIR')) SUBTREE(*OBJ)

This command restores all programs in the directory MYDIR to the directory YOURDIR.

RST DEV('/QSYS.LIB/MYLIB.LIB/MYSAVF.FILE') OBJ(MYDIR)

Restoring From a Save File. This command restores the directory MYDIR from a save file named MYSAVF in a library named MYLIB.

RST DEV('DevLink') OBJ(('DirLink') ('FileLink'))

Using Symbolic Links. To restore the objects in SomeDirectory from device TAP01: DevLink points to /QSYS.LIB/TAP01.DEVD, DirLink to /SomeDirectory, and FileLink to /SomeDirectory/SomeFile.

RST DEV('DevLink') OBJ(('DirLink/*'))

Restores the objects in SomeDirectory from tape device TAP01.

IBM command documentation

Generated from os/cl/catalog/RST.json and os/cl/help/RST.json.