Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default Policy - DB backup - Retention Period

Status
Not open for further replies.

mikehday

MIS
Mar 28, 2003
116
US
I just noticed a serious blunder of ours. No matter what retention date I set on a schedule in my database backup policies it uses the retention period setup in the Default-Application-Backup schedule. I have 3 schedules setup ... 1 for a week retention, month and a year. But since the Default-Application-Backup schedule is set for a week all backups only have a week rention. How do I fix this? I've got 20 database backup policies. I don't want to create 40 more ... 1 for each schedule!
 
My experience is that you need to set up your policies by the commonality of the files/clients. Then set up the three schedules for your different retention periods. Easy to do my copying the schedules and changing the retention times. Using your retention time as the common item and trying to fit your servers/files that common item is headed in the wrong direction, in my opinion. I have the about 20 policies for different uses/servers each with 3 different retention time schedules within week, month, year. Someone else may see it differently, however.
 
First - Set you user retentions correctly - One for each schedule. This will take care of future backups. Now, fix the problem of the existing backups.

Get the tapes used for a specific time frame ...
bpimagelist -media -U -d <start time mm/dd/yyyy HH:MM:SS> -e <end time mm/dd/yyyy HH:MM:SS> -server <MediaServer>
So if for example you have backups from the weekend of August 1st and you want to be able to change the backup retentions and your master server name is as an example vermaster you would run:
bpimagelist -media -U -d 08/01/2003 12:00:00 -e 08/03/2003 12:00:00 -server vermaster > d:\tapes.txt
Creating the tapes.txt is vital to run scripts against. If you have multiple media servers, run the same command against each and append the results to the tape.txt file - Do not have any spaces in it and at the end of the text file, type in END_OF_LIST on a line on it's own.
e.g. of tapes.txt
A00000
A00001
A00002
END_OF_LIST

Now that you have the tapes used in that time frame you want to check all the tapes for any images that have the specific retention level and output those results to a file:

#!/bin/ksh
#
#
###############################################################################
#
# Name: Change_Retention_Levels.ksh
# Purpose: This script checks all images on the tapes specified for
# Retention levels of 7 days
#
# Modified by: Steve Staves
# Date Created: June 2nd, 2003
#
###############################################################################
#
# Set up variables

MASTER=<Your master servres name>
BPDIR=<Install location>/netbackup/bin/admincmd
TAPES=d:/tapes.txt
#This is where we saved the tapes list from the previous step
TMPF1=d:/image_ids.txt

##################################################################
#
# Initialize Log File(s)

rm $TMPF1

##################################################################
#
# Main body of Script


# Get the specific images with a retention 0f 7 days (ret 1) from each tape
# <===Note that I used the -rl value of 1 for 7 days
cat $TAPES | while read LINE
do
case $LINE in
*)
$BPDIR/bpimmedia -mediaid $LINE -rl 1 -l |grep IMAGE |awk '{print $4}' >> $TMPF1
#Change the -rl value if it is not 1 ... Check the GUI under retention levels on the master for the numerical value assigned to the specific level
if [ $LINE = &quot;END_OF_LIST&quot; ]
then
fi
esac
done
exit


Now - The next step is to change the images to a retention that you want. We'll assume that a -rl of 2 is 1 month - This will depend on your environment and what you what the images to be - Check the master for the retention levels and corresponding numbers.

#!/bin/ksh
#
#
###############################################################################
#
# Name: Change_Retention_Levels.ksh
# Purpose: This script changes the retention levels of tapes used for
# monthly backups from 7 days to 30 days.
#
# Modified by: Steve Staves
# Date Created: June 2nd, 2003
#
###############################################################################
#
# Set up variables

MASTER=<Your master server>
BPDIR=<install location>/netbackup/bin/admincmd
TMPF=d:/results.txt
TMPF1=d:/image_ids.txt

##################################################################
#
# Initialize Log File(s)

rm $TMPF

##################################################################
#
# Main body of Script


# Change the retention level of the images

cat $TMPF1 | while read LINE1
do
case $LINE1 in
*)
$BPDIR/bpexpdate -recalculate -backupid $LINE1 -ret 2 -force
echo $BPDIR/bpexpdate -recalculate -backupid $LINE1 -ret 2 -force >> $TMPF
if [ $LINE1 = &quot;END_OF_IMAGES&quot; ]
then
fi
esac
done

In this second script the retention level is denoted by -ret and not -rl (I wish they would keep it the same ...)

I hope this helps you fix your backups...Let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top