DB2 backups with EMC NetWorker
Working with third party backup solutions in DB2 can be a bit of a challenge at times. About a year ago I setup an EMC NetWorker backup environment for DB2 9.5 running under AIX.
For this example we will call the database 'db2demo'.
We firstly, need to get access to the EMC NetWorker backup environment and to create the
xbsa_config file. In our case the
xbsa_config file was created in the top level of the DB2 instance owner directory, but it could be anywhere.
The parts of the
xbsa_config file the dba supplies are as follows.
DB2_VENDOR_LIB_PATH=/usr/lib/libnsrdb2.so DB2_USR=db2demo DB2_NODE_NAME=schlumpf DB2_ALIAS=db2demo DB2INSTANCE=db2demo INSTHOME=/data/db2demo DB2_APPLY_NW_LEVELS=TRUE DB2_OPTIONS=DB2BACKUP_ONLINE,DB2BACKUP_DB DB2_NUM_BUFFERS=4 DB2_SESSIONS=2 DB2_PARALLELISM=2 DB2_PSWD=********
Note: The DB2_PSWD is actually displayed as an encrypted value I have used *** to obfusicate.
DB2_PASSWD is generated with the
nsrdb2sv command. For example:
nsrdb2sv -p <password> -f <filename>
You only need the password if you are having the backup environment start the backups for you. If you initiate your backups from the DB2 side this value is not used.
At this point you should validate that you can in fact backup to NetWorker. It makes sense to test that now before turning on log backups, even though you will need to do another backup again after you turn on log backups. There is nothing worse than being in a backup pending situation if your networker config isn't working.
> db2 backup db db2demo load /usr/lib/libnsrdb2.so db2demo @/data/db2demo/xbsa_config compress"
Assuming that worked then we turn on log file archiving as follows
> db2 update db cfg for db2demo using LOGARCHMETH1 'VENDOR:/usr/lib/libnsrdb2.so' > db2 update db cfg for db2demo using LOGARCHOPT1 @/data/db2demo/xbsa_config
Now rerun a offline backup again.
> db2 backup db db2demo load /usr/lib/libnsrdb2.so options @/data/db2demo/xbsa_config compress
If that works generate some traffic so log files get backed up. Validate that this is successful. Then test the restore and roll forward.
> db2 restore db db2demo load /usr/lib/libnsrdb2.so options @/data/db2demo/xbsa_config_sam taken at <timestamp> without prompting > db2 rollforward database quote to <timestamp> using local time and stop;
If all went well then you are now using EMC NetWorker.
These are errors from the backup software passed through the database. Additionally changing the
DEBUG level of various variables in the
xbsa_config file will give you additional info but be warned 9 is the highest and can generate an enormous amount of data. For example:
NSR_DEBUG_LEVEL=5 NSR_DEBUG_FILE=/nsr/applogs/db2.log NSR_DB2SV_DEBUG_LEVEL=5 NSR_DB2SV_DEBUG_FILE=/nsr/applogs/db2sv.log NSR_LIBNSRDB2_DEBUG_LEVEL=5 NSR_LIBNSRDB2_DEBUG_FILE=/nsr/applogs/db2sql.log NSR_DB2UEXT2_DEBUG_LEVEL=5 NSR_DB2UEXT2_DEBUG_FILE=/nsr/applogs/db2uext2.log
If you still cannot backup using NetWorker you will likely need to engage support from the EMC side and/or the IBM DB2 side.
Useful DB2 command
To see the current values for those administration configuration parameters relevant to the DAS(DB2 Administration Server):
> db2 get admin cfg
To discovery of administration Servers, instances, and databases:
> db2 get dbm cfg > db2 get db cfg for <dbname>
Show DB2 service level command:
Showing All Current Profile Registry Settings:
> db2set -all
To list database directory & instance:
> db2 list db directory > db2 get instance
Set debug level 9 in the backup command. For example:
> nsrdasv -D 9 -z e:\tmp\nmdb2_demo2.cfg
Set debug files in DB2_CFG file
Note: By default, error messages are written to
- db2diag.log (in DB2 SQLLIB/DB2 install directory)