How do you back up and restore data on AS400?

Backup and Restore on AS/400 (IBM i)

Backing up and restoring data on AS/400 (IBM i) is essential for system recovery, disaster preparedness, and maintaining business continuity. Below are the key methods, commands, and best practices for backup and restore operations.

1. Backup Methods in AS/400
A. SAV Commands (Save Commands)

IBM i provides various SAV* commands to back up different objects:

Command Purpose
SAVLIB Saves a library (including objects and data)
SAVOBJ Saves a specific object (e.g., files, programs)
SAVDLO Saves documents and folders
SAVCFG Saves system configuration
SAVSYS Saves entire system (Licensed Internal Code, QSYS library, OS, and user profiles)
SAVSECDTA Saves security data (user profiles, authorization lists, passwords, etc.)
SAVCHGOBJ Saves only changed objects since last backup

B. Full System Backup (GO SAVE) :

IBM i provides the GO SAVE menu for automated backup operations.

Command :

GO SAVE
  • Presents a menu with predefined backup options.
  • Common options:
    • Option 21: Full system backup (includes OS, libraries, and configurations).
    • Option 23: Backup user libraries.
    • Option 24: Backup only changed objects.

2. Backup Commands & Examples :
A. Backing Up an Entire Library (SAVLIB) :
SAVLIB LIB(MYLIB) DEV(TAP01) SAVACT(*YES)
  • Saves MYLIB to tape device TAP01.
  • SAVACT(*YES) allows saving active objects.
B. Backing Up a Specific Object (SAVOBJ) :
SAVOBJ OBJ(MYFILE) LIB(MYLIB) DEV(*SAVF) SAVF(MYLIB/MYBACKUP)
  • Saves MYFILE from MYLIB into a save file (MYBACKUP).
C. Backing Up Security & Configuration Data :
SAVSECDTA DEV(TAP01)
SAVCFG DEV(TAP01)
  • Saves user profiles, passwords, authorization lists, and configurations.
D. Backing Up Only Changed Objects (SAVCHGOBJ)
SAVCHGOBJ OBJ(*ALL) LIB(MYLIB) DEV(TAP01) REFERENCE(*LIB)
  • Saves only changed objects since the last reference backup.

3. Restore Methods in AS/400 :
A. RST Commands (Restore Commands) :

IBM i provides various RST* commands for restoring data:

Command Purpose
RSTLIB Restores an entire library
RSTOBJ Restores specific objects
RSTUSRPRF Restores user profiles
RSTCFG Restores system configurations
RSTSYS Restores the entire system (from SAVSYS backup)

B. Restore Commands & Examples :
A. Restoring an Entire Library (RSTLIB)
RSTLIB LIB(MYLIB) DEV(TAP01) MBROPT(*ALL) ALWOBJDIF(*ALL)
  • Restores MYLIB from TAP01 tape.
  • MBROPT(*ALL): Restores all members of files.
  • ALWOBJDIF(*ALL): Allows restoring even if object differences exist.
B. Restoring a Specific Object (RSTOBJ)
RSTOBJ OBJ(MYFILE) LIB(MYLIB) DEV(*SAVF) SAVF(MYLIB/MYBACKUP)
  • Restores MYFILE from MYBACKUP save file.
C. Restoring User Profiles (RSTUSRPRF)
RSTUSRPRF DEV(TAP01) USRPRF(*ALL)
  • Restores all user profiles from backup.
D. Restoring System Configuration (RSTCFG)
RSTCFG OBJ(*ALL) DEV(TAP01) OBJTYPE(*ALL)
  • Restores system configuration from backup.
E. Restoring the Entire System (RSTSYS)
RSTSYS DEV(TAP01)
  • Used during disaster recovery to restore the operating system and system libraries.
  • Usually done after an IPL (Initial Program Load).

4. Save File (SAVF) Backups (Disk-Based Backup)

Instead of using tapes, backups can be stored in a save file (SAVF) on disk.

A. Creating a Save File
CRTSAVF FILE(MYLIB/MYBACKUP)
B. Saving Data to a Save File
SAVLIB LIB(MYLIB) DEV(*SAVF) SAVF(MYLIB/MYBACKUP)
C. Restoring from a Save File
RSTLIB LIB(MYLIB) DEV(*SAVF) SAVF(MYLIB/MYBACKUP)

5. Automating Backups Using Job Scheduler

IBM i allows scheduling backups using job scheduler (WRKJOBSCDE).

Example : Schedule Nightly Library Backup
ADDJOBSCDE JOB(BACKUP) CMD(SAVLIB LIB(MYLIB) DEV(TAP01)) 
FRQ(*DAILY) SCDTIME(230000)
  • Runs a backup daily at 11:00 PM.

6. Best Practices for Backup & Restore

* Perform regular full backups (SAVSYS, SAVLIB, SAVSECDTA, SAVCFG).
* Use Save Files (SAVF) for faster, disk-based backups.
* Schedule incremental backups (SAVCHGOBJ) to save only changed objects.
* Verify backups using DSPTAP (Display Tape Contents).
* Perform test restores to ensure backup integrity.
* Store backups offsite for disaster recovery.
* Monitor backup jobs using WRKACTJOB.


7. How to Check Backup Status & Logs :
A. Check Tape Contents (DSPTAP)
DSPTAP DEV(TAP01) DATA(*SAVRST)
  • Displays what is stored on a tape.
B. Check System Logs for Backup Messages
DSPLOG PERIOD((*AVAIL *CURRENT))  
  • Shows errors or completion messages related to backup jobs.

Summary of Key Backup & Restore Commands :
Task Backup Command Restore Command
Entire Library SAVLIB LIB(MYLIB) DEV(TAP01) RSTLIB LIB(MYLIB) DEV(TAP01)
Specific Object SAVOBJ OBJ(MYFILE) LIB(MYLIB) DEV(*SAVF) RSTOBJ OBJ(MYFILE) LIB(MYLIB) DEV(*SAVF)
User Profiles SAVSECDTA DEV(TAP01) RSTUSRPRF DEV(TAP01) USRPRF(*ALL)
System Configuration SAVCFG DEV(TAP01) RSTCFG DEV(TAP01) OBJ(*ALL)
Entire System SAVSYS DEV(TAP01) RSTSYS DEV(TAP01)