Recently I had to restore a user’s mail file to pull data that was accidentally deleted. Of course the tape I needed happened to already be in the drive and with my handy notes from last time I was able to restore it quickly and pull the data needed. Now I want to share my notes with you.
- Check the name of your tape drive using the command WRKDEVD (scroll through the list of devices and look for your tape drive; in my case it was TAP01)
- Load the tape into the tape drive with the mail file you would like to restore
- Run command (this submits the command as a job, which I highly recommend, instead of running it interactively – if you need a bigger command line area to past this into use the command CALL QCMD): SBMJOB CMD(RST DEV(‘/QSYS.LIB/TAP01.DEVD’) OBJ((‘/notes/data/mail/%original name of the mail file%.nsf’ *INCLUDE ‘/notes/data/Recovery/%new name of the mail file%.nsf’)) OUTPUT(*PRINT))
- WRKSBSJOB + F4 and enter subsystem QBATCH
- Watch the job until it completes
- **VERY IMPORTANT** Disable Replication in Application Properties under Replication, under Database -> Replication, and in the ACLs if necessary (this should prohibit the restored database from replicating with the user’s current database).
- If you want to verify that everything went through smoothly, you can check the spool file that was created when we submitted the job. Go to WRKSPLF and check one of the last jobs (it should be 1 page). Page Down and look at the Totals.
- Copy and paste the emails to restore from the restored DB to the current DB (You might have to change the ACLs back to allow replicate and copy documents in order to copy the files but I didn’t have to)
- Eject the tape; Restore complete.