Restoring Spooled File Data After a System Restore
July 15, 2009 Hey, Joe
I recently performed a complete i5/OS system restore, using my weekly system save and a current daily backup. During the restore, I cleared and restored my user libraries from the daily backup, except for the QUSRSYS or QGPL libraries, which were current. However, once we start saving output queues on i5/OS V5R4 (we’re still on V5R3), how should I restore QUSRSYS and QGPL, where our output queues reside?
Although QUSRSYS and QGPL technically aren’t IBM libraries, on most systems they usually contain some user and third-party objects. Looking at one of my systems, here’s what I found in QGPL:
QUSRSYS generally doesn’t fare any better. A quick glance there finds job queues, output queues, subsystem descriptions, and message queues. To repeat, while IBM doesn’t designate QGPL and QUSRSYS as system libraries (even though they start with the letter ‘Q’), they should at least be accorded the same status as critical production libraries.
Which gets us back to the sticky situation of how do you restore output queues to QGPL and QUSRSYS after a system restore? My idea involves restoring them in conjunction with your QGPL and QUSRSYS library restores.
Since you’re not currently saving output queues, here’s some code I developed for saving output queues while the system is active.
SAVOBJ OBJ(*ALL) LIB(QGPL QUSRSYS) DEV(TAP01) + OBJTYPE(*OUTQ) ENDOPT(*LEAVE) + SAVACT(*SYSDFN) SAVACTWAIT(60) + SAVACTMSGQ(MESSAGE/SAVEMSGQ) + SPLFDTA(*ALL) /* Save all output queues + and spooled files in QGPL and QUSRSYS */
This will save all the output queues and spooled file data in both libraries. If any queue is in use, it waits 60 seconds for the holding job to unlock it before moving on to the next queue (as defined by the SAVACT, SAVACTWAIT, and SAVACTMSGQ parameters). The Spooled File Data parameter (SPLF) of *ALL is important because it saves all the Spooled File data and attributes for each output queue in your system, so each save should be a complete backup of all your output queues.
I recommend saving your output queues with a separate command like this every day because it will make it easier to restore the queues later. You might also want to run it at the end of your weekly system backups.
That said, here’s how I would go about restoring QGPL and QUSRSYS so that you get both the libraries and their spooled file data restored after a system rebuild:
1. Since you backup all the files in QGPL and QUSRSYS every night, I would first clear and restore the two libraries from your latest daily tape (or the weekly backup, if that was your latest backup). You can do this by running these three Clear Library (CLRLIB) and Restore Library (RSTLIB) commands.
CLRLIB LIB(QGPL) CLRLIB LIB(QUSRSYS) RSTLIB SAVLIB(QGPL QUSRSYS) DEV(TAP01) MBROPT(*ALL) SPLFDTA(*NONE) ALWOBJDIF(*ALL)
You might need to put the system into restricted state in order to clear and restore these libraries.
The key parameters in the RSTLIB statement are the MBROPT(*ALL) parameter, which restores all data members, and ALWOBJDIF(*ALL), which restores files regardless of whether they already exist in those libraries. (I do this just to be safe.) Because you are specifying SPLFDTA(*NONE), your output queues will be restored, but this command will not restore any of your spooled file data. The reason you may not want to restore spooled files from your backup is that the default parameter for saving spooled file data and attributes (SPOOL) is *NONE on the Save Library command (SAVLIB), so there may not be any spooled files to restore. Also, if you’re restoring from a system backup tape that did have spooled files, the spooled files may be a little bit old and out of date, and the restored output queues could contain several spooled files that may have been deleted off the system after the option 21 backup was created. So what this QGPL and QUSRSYS restore does is to set up these libraries and make them ready to restore your most recent spooled files.
2. After you restore QGPL and QUSRSYS from backup, you can run the following Restore Object (RSTOBJ) command to restore your output queue spooled files, using the tape media you created when you ran the spooled file SAVOBJ command above.
RSTOBJ OBJ(*ALL) SAVLIB(QGPL QUSRSYS) DEV(TAP01) OBJTYPE(*OUTQ) SPLFDTA(*NEW)
Running this command should restore any spooled files that don’t already exist in the output queues in the libraries. The key to running this command is the Spooled File Data (SPLFDTA) parameter equal to *NEW. That tells RSTOBJ to restore all the spooled files on the tape, regardless of whether or not they already exist in QGPL or QUSRSYS. Since you restored QGPL and QUSRSYS earlier without any spooled files at all, this will restore only the most recent spooled files as of your last backup tape.
The other nice thing about using a separate RSTOBJ statement to restore spooled files is that you can use it to bring back your spooled files at any time, not just during a system restore. Performing these two steps should allow you to restore QGPL and QUSRSYS with their most recent spooled files intact. After you upgrade to i5/OS V5R4 or V6R1 and get a chance to try this technique, be sure to let me know how it goes.