SAVRSTLIB (Save/Restore Library)
SAVRSTLIB Command syntax diagram
Purpose
The Save/Restore Library (SAVRSTLIB) command allows the user to save and restore a copy of one or more libraries to another system. The system must have a supported communication link with the restoring system.
Documents and folders contained in the QDOC library can be saved and restored by using the Save/Restore Document Library Object (SAVRSTDLO) command.
The SAVRSTLIB command saves and restores the entire library; this includes the library description, the object descriptions, and the contents of the objects in the library. For job queues, message queues, output queues, data queues, and logical files, only the object definitions are saved and restored, not the contents. Logical file access paths can be saved and restored by specifying ACCPTH(*YES). The contents of a save file can be saved by using the Save Save File Data (SAVSAVFDTA) command. By specifying SAVFDTA(*YES) on the SAVRSTLIB command, the contents of a save file can be saved and restored.
The libraries and their objects are not affected on the system unless the command specifies that the storage is to be freed. If a group of libraries is saved by specifying *NONSYS, *ALLUSR, or *IBM for the LIB parameter, the date, time, and place are updated in the history information for a data area in QSYS (data area QSAVLIBALL, QSAVALLUSR, or QSAVIBM).
The types of objects saved and restored by this command are the same as those listed for the OBJTYPE parameter in with the addition of *DTADCT. Certain OS/400 system objects that are not contained in user libraries (such as user profiles) are not saved and restored by this command. They can be saved by the Save System (SAVSYS) or Save Security Data (SAVSECDTA) commands, and restored by using the Restore User Profile (RSTUSRPRF) command.
Restrictions
- To use this command, the user must have either the special authority *SAVSYS specified in the user profile by the SPCAUT parameter, or the user must have:
- Read authority for, or be the owner of, each library specified.
- Object existence authority for each object in the library.
If the user does not have the correct authorities for all of the libraries and objects specified, only those for which the user does have authority are saved and restored.
- No library that is being saved and restored, or the objects in the library being saved and restored, can be updated by a job that is running at the time the save and restore operation occurs unless save-while-active (SAVACT) is used.
- When the contents of a save file are saved and restored by specifying SAVFDTA(*YES), the save file must be restored before objects contained in it can be restored.
- Both systems intended to participate in the save and restore operation must be connected to the same APPN network or, if the OptiConnect/400 option is to be used, both systems must be joined by the OptiConnect for OS/400 hardware and software.
Required Parameters
- LIB
- Specifies which libraries to save and restore.
Note: If using *NONSYS, or *IBM keywords some libraries will not be saved and restored, because they are being used for this operation.
Note: If the user specifies *ALLUSR on this parameter, this command should be run when the specified libraries are not being used. If objects in a library are in use while the library is being saved and restored, the objects are not saved and restored. Some subsystems cannot be ended when using the SAVRSTLIB command. The libraries associated with these subsystems will not be saved and restored using the SAVRSTLIB command. QSOC - if using the optical bus transport with the SAVRSTLIB command QCMN - if using the communications transport with the SAVRSTLIB command*NONSYS: All user-created libraries, the QGPL and QUSRSYS libraries, and licensed program libraries such as QRPG and QIDU are saved. When *NONSYS is specified, the libraries are saved in alphabetical order on the media.
*IBM: Saves all system (IBM) libraries except for the following Q libraries:
QDOC QRCLxxxxx QSYS2 QUSRINFSKR QDOCxxxx QRCYxxxxx QSYS2xxxxx QUSRNOTES QDSNX QRECOVERY QS36F QUSROND QGPL QRPLOBJ QTEMP QUSRPOSGS QGPL38 QRPLxxxxx QUSER38 QUSRPOSSA QMPGDATA QSPL QUSRADSM QUSRPYMSVR QMQMDATA QSPLxxxx QUSRBRM QUSRRDARS QMQMPROC QSRV QUSRDIRCL QUSRSYS QPFRDATA QSYS QUSRDIRDB QUSRVI QRCL QSYSxxxxx QUSRIJS QUSRVxRxMx
Note: A different library name, in the format QUSRVxRxMx, can be created by the user for each previous release supported by IBM to contain any user commands to be compiled in a CL program for the previous release. For the QUSRVxRxMx user library, VxRxMx is the version, release, and modification level of a previous release that IBM continues to support. The following libraries with names that do not begin with the letter Q are also saved:
#CGULIB #DFULIB #RPGLIB #SEULIB #COBLIB #DSULIB #SDALIBlibrary-name: Specify the names of the library to be saved and restored. A maximum of 300 library names can be specified.
generic*-library-name: Specify the generic name of the library. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk (*) substitutes for any valid characters. A generic name specifies all libraries with names that begin with the generic prefix, for which the user has authority. If an asterisk is not included with the generic (prefix) name, the system assumes it to be the complete library name. A maximum of 300 generic library names can be specified. For more information on the use of generic functions, refer to generic functions.
- RMTLOCNAME
- Specifies the remote location to connect with. Specify the remote location name using the format cccccccc or nnnnnnnn.cccccccc, where nnnnnnnn is the network identifier (ID) and cccccccc is the remote location name.
remote-location-name: Specify the remote location name associated with the system to which you want to restore objects. The local network ID (LCLNETID) network attribute is used as the value of the network identifier.
network-ID.location-name: Specify the network identifier and the remote location name associated with the system to which you want to restore objects.
Optional Parameters
- STRLIB
- This parameter is the same as the STRLIB parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- OMITLIB
- This parameter is the same as the OMITLIB parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- OMITOBJ
- This parameter is the same as the OMITOBJ parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- ASPDEV
- This parameter is the same as the ASPDEV parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- TGTRLS
- This parameter is the same as the TGTRLS parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- PRECHK
- This parameter is the same as the PRECHK parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- SAVACT
- This parameter is the same as the SAVACT parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- SAVACTWAIT
- This parameter is the same as the SAVACTWAIT parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- SAVACTMSGQ
- This parameter is the same as the SAVACTMSGQ parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- ACCPTH
- This parameter is the same as the ACCPTH parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- SAVFDTA
- This parameter is the same as the SAVFDTA parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description. and restored.
- STG
- This parameter is the same as the STG parameter for the SAVLIB command. If you need further assistance, go to SAVLIB to see a detailed parameter description.
- OPTION
- This parameter is the same as the OPTION parameter for the RSTLIB command. If you need further assistance, go to RSTLIB to see a detailed parameter description.
- MBROPT
- This parameter is the same as the MBROPT parameter for the RSTLIB command. If you need further assistance, go to RSTLIB to see a detailed parameter description.
- ALWOBJDIF
- This parameter is the same as the ALWOBJDIF parameter for the RSTLIB command. If you need further assistance, go to RSTLIB to see a detailed parameter description.
- RSTLIB
- Specifies whether the library contents are restored to the same library from which they were saved, or to a different library. If a different library is specified, the user cannot specify *NONSYS, *ALLUSR, or *IBM on the LIB parameter.
*LIB: The library contents are restored to the same library or libraries from which they were saved.
library-name: Specify the name of the library where the saved library contents are being restored. If *NONSYS, *ALLUSR, or *IBM is specified on the LIB parameter, a library name cannot be specified on this parameter.
Note: If an SQL database is restored to a library other than the one in which it was saved, the journals are not restored.
- RSTASPDEV
- This parameter is the same as the RSTASPDEV parameter for the RSTLIB command. If you need further assistance, go to RSTLIB to see a detailed parameter description.
- RSTASP
- This parameter is the same as the RSTASP parameter for the RSTLIB command. If you need further assistance, go to RSTLIB to see a detailed parameter description.
- FRCOBJCVN
- This parameter is the same as the FRCOBJCVN parameter for the RSTLIB command. If you need further assistance, go to RSTLIB to see a detailed parameter description.
Examples for SAVRSTLIB
Example 1: Saving and Restoring All User Libraries
SAVRSTLIB LIB(*ALLUSR) RMTLOCNAME(SYSTEM1) STRLIB(GFM1) OPTION(*OLD)This command saves all user libraries beginning with the GFM1 library and restores them on a remote system named SYSTEM1. Only the objects in the library having a saved version are restored.
Example 2: Saving and Restoring Specific Libraries
SAVRSTLIB LIB(GRUNBOK TIMON VASEK) RMTLOCNAME(SYSTEM1)This command saves the following libraries GRUNBOK, TIMON and VASEK and restores them on a remote system named SYSTEM1.
Error messages for SAVRSTLIB
*ESCAPE Messages
- CPCAD81
- &1 libraries saved and restored.
- CPFAD8B
- An error occurred during the SAVRSTLIB operation.
- CPFAD80
- Unable to establish connection from &1 to &2.
- CPFAD81
- User profile &1 not found on remote location &2.
- CPFAD82
- Remote location &1 not found.
- CPFAD83
- Remote location &1 cannot be source location.
- CPFAD84
- ObjectConnect/400 internal error, function code &1, return code &2.
- CPFAD86
- Location name &1 unable to close &2.
- CPFAD88
- Unable to establish connection from &1 to &2.
- CPFAD93
- APPC failure. Failure code is &3.
- CPF389C
- ObjectConnect/400 internal error, function code &1, return code &2.