Follow up on my blog about moving to an online DB2 backup: https://www.angioni.nl/2020/03/26/transitioning-to-online-backup-in-db2/

Here is the procedure to restore an online created DB2 database-backup. It’s not a “normal” restore, next, next finish procedure. This is my procedure for restoring an online backup from a DB2 database and forward it to the end of the backup.

Environment:
a. Online backup folder: /data/onlinebackups
b. Restore folder: /data/restore
c. Logs restore folder: /data/restore
d. DB2 database log folder: db2 get db cfg for <database_alias> |grep LOGARCHMETH1

Procedure:
#just to be sure the folders exists
mkdir /data/restore/logs -P

#clearing the restore logs
rm -f /data/restore/logs/*.LOG

#Get the backupfile(s)
<Restore from your backup device into /data/onlinerestore, or copy the file from /data/onlinebackups to /data/restore>

#Drop and recreate database
db2 drop database <database_alias>
db2 create database <database_alias> ( or use the vendor’s script to re-create the database )

#Restore database from online backup
db2 restore db <database_alias> from /data/restore taken at <time_stamp> into <database_alias> logtarget /data/restore/logs replace existing without prompting

#Copy restored log into database logs folder
cp /data/restore/logs/*.LOG </PATH/TO/LOG/FILES determined in d. >

#Roll forward the database to the end of the backup
db2 rollforward db <database_alias> to end of backup and stop


And that’s it…..Once you know it, it’s simple.

Visits: 1972

By angioni

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.