Media failure is a serious hardware mishap such as a disk crash.
Media Failure Recovery
You can restore a backup copy of a location's files and replay the contents of a discrete series of log files against the restored location using the ROLLFORWARD command.
A discrete series of log files consists of all changes made to the data objects within an location since the last time the logging system for that location was reset (usually after the last location backup). You must configure the server to ensure that your system is keeping log files. See the section Server Configuration - Delete Old Logs for more information.
If you have made periodic backups of your location (resetting the logging system after each backup), and you have configured your server to keep old logs, you can usually recover from a media failure.
To recover from a media failure:
If you used the BACKUP LOCATION command:
Make sure that the server is shut down, and that all destination directories and subdirectories exist (the restore program will not create directories). Then, change to the drive and directory where the backup batch file resides and enter the following at the operating system command line:
xdbrest
Any files in the destination directories will be overwritten. Log files will not be restored.
If you used your operating system or other utility:
You must restore files using the compatible operating system restore command prior to recovery.
If you need to restore location files on a different drive or in different paths than they previously resided, be sure to edit the appropriate system tables to make the XDB Server aware of the new location names and paths. Edit SYSXDB.SYSLOCALS and SYSIBM.SYSLOCATIONS tables to specify location names and path names. Edit SYSIBM.SYSSTOGROUP and SYSIBM.SYSVOLUMES to specify stogroup information. Also check the server machine's configuration file for other special directories, such as index paths.
Issue the following SQL command:
ROLLFORWARD location-name USING log-path
where location-name is the name of the location containing the restored backup files and log-path is the drive and path name of the directory containing the anchor file and series of log files to be replayed against the restored location. This directory should contain the anchor.log file plus one or more log files beginning with the file named ?0000000.log (where ? = [a-z]).
For example, the following ROLLFORWARD command would apply the log files contained in the directory c:\xdbnt\logfiles (Windows) or /xdb/logfiles (UNIX) to the system location
ROLLFORWARD system USING c:\xdbnt\logfiles
ROLLFORWARD system USING /xdb/logfiles
During a ROLLFORWARD, all transactions contained in the location log files are replayed against the restored location.
In cases where multiple series of log files are being replayed against an older location backup:
The sum total of all ROLLFORWARD operations applied against a restored location causes the logging system to run through all the transaction data contained in each series of log files, returning the location to the state it was in immediately before the system failure.
When the recovery process is complete, press Esc to exit the SQL Wizard (Windows) or Interactive SQL (UNIX).
After all recent log files have been applied to the restored backup copy of the location, your data tables should be returned to a state existing prior to the media failure.