05-13-2015 07:49 AM
Hello,
I'm facing the same issue as Don_w on this topic : http://www.symantec.com/connect/forums/db2-backup-difference-retention
Our client need to backup one db2 instance every day with a retention of 3 days, and every week with 3 weeks retention.
I created 2 differents policies, but when the daily policy starts, it calls the schedule of the other policy, so the retention is 3 week!
I would like to know how can I configure my script runs by netbackup (version 6.5.6), to use the correct policy and the correct schedule to have my daily backup with 3 days retention.
Schedules contain a Default-Application-Backup and my schedule in Automatic Full Backup.
My script in attachment.
Thanks for your help.
Solved! Go to Solution.
05-14-2015 02:27 AM
See if this TN helps:
How to configure multiple schedules using DB2 to allow the db2 backup to have multiple retention levels in a Unix Environment
http://www.symantec.com/docs/TECH214813
This TN says it can be done with OPTIONS as well: http://www.symantec.com/docs/HOWTO89504
05-13-2015 08:12 AM
05-13-2015 09:08 AM
Done Marianne
#!/bin/sh
#bcpyrght
#***************************************************************************
#* $VRTScprght: Copyright 1993 - 2006 Symantec Corporation, All Rights Reserved $ *
#***************************************************************************
#ecpyrght
#
# These environment variables are initialized by Netbackup (bphdb)
#
echo "DB2_CLIENT = $DB2_CLIENT"
echo "DB2_SERVER = $DB2_SERVER"
echo "DB2_POLICY = $DB2_POLICY"
echo "DB2_SCHED = $DB2_SCHED"
echo "DB2_FULL = $DB2_FULL" # Is 1 if Full backup scheduled
echo "DB2_CINC = $DB2_CINC" # Is 1 if Cumulative incremental scheduled
echo "DB2_INCR = $DB2_INCR" # Is 1 if Differential incremental scheduled
#
# Change MY_LIB to the correct NetBackup library name for your host:
# Solaris or Linux 32-bit = nbdb2.so
# Solaris 64-bit = nbdb2.so64
# HPUX (ia64) = nbdb2.so
# AIX or HPUX = nbdb2.sl
# AIX or HPUX = nbdb2.sl64
#
MY_LIB=/usr/openv/netbackup/bin/nbdb2.sl64
#
# Change MY_DB2 to the correct DB2 instance name for your database.
#
MY_DB2=XXX
#
# Use the NetBackup schedule type to set DB2 full or incremental options.
#
if [ "$DB2_FULL" = "1" ] ; then
MY_SCHED=""
elif [ "$DB2_CINC" = "1" ] ; then
MY_SCHED="INCREMENTAL"
elif [ "$DB2_INCR" = "1" ] ; then
MY_SCHED="INCREMENTAL DELTA"
else
MY_SCHED=""
fi
#
# Initialize the backup command line.
# Customize the number of sessions and buffer options for your environment.
#
#CMD_LINE="db2 BACKUP DATABASE $MY_DB2 ONLINE $MY_SCHED LOAD $MY_LIB OPEN 2 SESSIONS"
CMD_LINE="db2 BACKUP DATABASE $MY_DB2 ONLINE $MY_SCHED LOAD $MY_LIB OPEN 2 SESSIONS EXCLUDE LOGS"
#
# Change MY_USER to the proper DB2 user for performing backups
#
MY_USER=XXX
echo "Executing: $CMD_LINE" > XXX
su - $MY_USER -c "$CMD_LINE"
RETURN_STATUS=$?
# Return 0 for success, non-zero for errors
exit $RETURN_STATUS
05-14-2015 02:27 AM
See if this TN helps:
How to configure multiple schedules using DB2 to allow the db2 backup to have multiple retention levels in a Unix Environment
http://www.symantec.com/docs/TECH214813
This TN says it can be done with OPTIONS as well: http://www.symantec.com/docs/HOWTO89504