Using Scripts

To restore the database, use the db2 restore command. Set restore parameters according these guidelines:

  • The restore statement must specify the same number of sessions as the backup on which it is based.

  • When specified, the "taken at" parameter must match the timestamp of the desired backup exactly. These can be found on records labeled CATRECORD in the file BEXdb2.log, which is in the logs subdirectory of the directory in which DPX is installed.

  • If "taken at" is not specified, the latest backup is used for the restore, and the number of sessions specified in the restore must match.

  • Always follow IBM recommended guidelines.

The following is a UNIX example of a DB2 restore script, which includes environment settings as well as the db2 restore statement:

#!bin/sh  
INSTHOME=/export/home/db2inst1; export INSTHOME  
SSPRODIR=/export/home/techsupp/BEX214d; export SSPRODIR  
LD\_LIBRARY\_PATH=$SSPRODIR/lib:$LD\_LIBRARY\_PATH; export LD\_LIBRARY\_PATH  
PATH=$SSPRODIR:$SSPRODIR/bin:$PATH; export PATH  

\# db2 ‑v restore database mydb1 load $SSPRODIR/lib/libbexdb2-shared.a.64 
open 1 sessions taken at 20010910111714 without rolling forward

echo done

The DB2 installation program for UNIX generates a sample script similar to the one above called db2restore, which is in the bin subdirectory of the directory in which DPX is installed. You can edit the sample script and then use it as your DB2 restore script in the INSTHOME directory.

Note. The script displayed above is an example of how to invoke DB2 support on DB2 UDB EE. On the Extended Enterprise version (EEE), restores can be run simultaneously on multiple nodes by using the db_all command.

Last updated