There are some assumptions before starting:
1. You backed up your DB2 database online and with INCLUDE LOGS directive and with “USEREXIT ON”.
2. You created two policies to backup your DB2 database, one “type DB2″ Backup and one Filesystem backup with User-Backup schedule.
3. Database name you backed up was SAMPLE, server name was db2server, instance name was DB2
4. Database name you will restore will also be SAMPLE, server name will be db2altsrv and instance name will also be DB2
5. You don’t need to create any database on the alternate client system.
6. Create No.Restrictions file inside “C:Program FilesVeritasNetBackupdbaltnames” directory to allow alternate client restore your original client’s data (Don’t forget to delete this file after your restore is completed).
To restore your database to alternate client db2altsrv:
1. You need to change client name inside the registry(Hint: You should change /usr/openv/netbackup/bp.conf if the client is unix)
2. Create your db2.conf file for restore on the alternate client, I created inside “C:Program FilesVERITASNetBackupDbExtdb2″ but it’s not really important where you create them.
| # $Header: db2.conf,v 1.6 2009/08/26 15:58:31 $
# # *************************************************************************** # * $Copyright: Copyright 1993 – 2011 Symantec Corporation, All Rights Reserved $ * # *************************************************************************** # # The following settings are used by NetBackup to backup/restore a DB2 database. # # Reminders: # 1) The specified policy must have a type of “DB2″. # 2) The specified schedule must be defined for this policy. # 3) The DB2 database host must be entered as a client for this policy. #
OBJECTTYPE ALTERNATE SRCINST DB2 # Instance You Backed up SRCALIAS SAMPLE # Database You Backed up DESINST DB2 # Instance You will Restore to DESTALIAS SAMPLE # Database You will restore to ENDOPER
DATABASE SAMPLE OBJECTTYPE DATABASE POLICY DB2-DBBackup # NetBackup Policy that backed up your database SCHEDULE Default-Application-Backup CLIENTNAME db2server # Client name that was backed up ENDOPER
# # The following settings are used by NetBackup to backup/restore DB2 log files. # Reminders: # 1) DB2 transcation logs can be backed up/restored using either # (a) DB2 User Exit Program # The specified policy must have a type of “Standard” (for UNIX DB2 # host) or “MS-Windows” (for Windows DB2 host). # # (b) LOGARCHMETH1 can be configured to use NetBackup. # (When LOGARCHMETH1 = “VENDOR:NetBackup for DB2 agent”) # This option is possible only for versions 8.2 and above. # The specified policy must have a type of DB2. # # 2) The specified schedule must be defined for this policy. # 3) The DB2 database host must be entered as a client for this policy. #
# ——————— # DB2 User Exit Program # ——————— # If DB2 log file archiving is enabled (DB2 USEREXIT ON), DB2 will invoke # the NetBackup user-exit program to backup & restore DB2 archive log files. # Using ARCFUNC SAVE causes log files to be archived to NetBackup storage, # as specified by the policy storage-unit setting. # Using ARCFUNC COPY causes log files to be archived to a disk directory. # Use ARCDIR to specify the destination directory for log file backup. # Use RETDIR to specify the source directory for log file restore. # DATABASE SAMPLE OBJECTTYPE ARCHIVE POLICY DB2-ArchLogBackup # NetBackup Policy that backed up Archive logs SCHEDULE User ARCFUNC SAVE ENDOPER |
3. Open DB2CMD and go into the directory “C:Program FilesVERITASNetBackupDbExtdb2″
4. Start your phase 1 restore (Keep in mind, restore is not completed with single command, so be patient)
5. When the first phase is completed, you will see the following message on the DB2CMD screen:
6. Complete the restore by issuing the following command:
6. At this point, from the Master Server, restore your Archive logs to the same place (NetBackup DB2 Administrator’s Guide says the logs can be restored to different locations, but i didn’t involve that here, if you tried and would like to share here, i would be glad to add here)
7. Finish restore by issuing the following command:
8. Check your sytem to see if your database is restored successfuly and is online:









Posted in
Tags: 