Raghu On Tech

Pro tips on managing data at scale

How To Perform Db2 Alternate Restore Using NetBackup ?

by | Mar 20, 2018 | 5 comments

Task Description:

You need to restore a Db2 database backup and archival logs backed up on source Db2 instance/server on to a different target Db2 instance/server, how would you go about it ?

 

Task Assumptions:

  • Host name of the source Db2 server is mysource.example.com. Source Instance name is srcinst1.
  • Host name of the target Db2 server is mytarget.example.com. Target Instance name is trginst1.
  • Name of the NetBackup Db2 policy is DB2_MAXIMA_BACKUPS

 

Task Prerequisites:

  • Acquire sudo access or make arrangements with some one in your organization to update “/usr/openv/netbackup/bp.conf“.
  • Ensure that the database backup on source database is taken with option BKUP_IMAGE_PERM=ANY. If not your target server/instance will not be able to read the database backup image.
  • Ensure that LOGARCHOPT1 parameter on source database was set to BKUP_IMAGE_PERM=ANY. If not your target server/instance will not be able to read transaction log files for rollforward recovery.
  • Confirm that “/usr/openv/netbackup/db/altnames/No.Restrictions” exist on the NetBackup master server.

 

Task Procedure:

Source side:

You can see what backup files are available for you to restore using the bplist command on the source. If you run the below command please note that it will use the CLIENT_NAME from /usr/openv/netbackup/bp.conf and not the one from db2.conf under instance home directory.

 

Target side:

Only changes you need to make on the target is to db2.conf under the target instance home directory. Following are the changes that needs to be made.

  • Add an entry stating that the restore we are about to perform is alternate restore.
  • There should be a block entry for source database, target database, source log files and target log files. Here is where things get tricky, you should absolutely add two entries one for source and another one for target even if the database names are same and entries look identical.
  • Modify the CLIENT_NAME in side db2.conf to point to the source database server. DO NOT modify the CLIENT_NAME property in /usr/openv/netbackup/bp.conf or other Db2 instances using the bp.conf will get impacted during this restore process.

Below is how db2.conf should look like after the edits.

Restoring The Database:

If the tablespace container definitions are same between both source and target database, you can perform a restore operation normally. Otherwise you need to perform redirected restore operation as shown below.

 

When you do not specify a timestamp during a restore operation then the latest backup image on the media storage will be used.

 

Now edit the file generated by the generate script option of redirected restore operation to update your tablespace containers paths or  Storage group paths or Automatic storage paths or Database name or NEWLOGPATH etc.

 

 

Now perform the rollforward to end of the log files.

To conclude, when you are using NetBackup as your storage solution for backups and you need to perform a restore of database from one server to another server, you need to use Alternate restore even though the name of the database is same and the tablespace container paths do not change. To sum it up, the NetBackup term Alternate restore is not equivalent to redirected restore on the Db2 end.

Please leave a comment if you have any questions related to this topic.

Shares
Share This

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close