What I do is I keep my clones on site for 14 days and use a script to delete saveset id's in the clone pool that are older than the 14 day limit. This was the onsite clone is only kept for X days.
Sample ONLY
#!/usr/bin/ksh
# ################################################################################################
#AUTHOR: Ed Skolnik
#MODIFIED: 2003/003/04 EIS Created
#
# This script is used to free up clone saveset's and volumes
# We will be cloning the world and sending the orginal volumes offsite, Our SLA
# is such that we only will have the most current save sets on site (right now it's 14 days,
# but for the sake of it I am testing with a 30 day on site plan).
# This script will delete any clone from the media database based on the above. It will also
# mark any "Default Clone" pool tapes that have zero saveset as recycleable.
#
# 2003/06/13 EIS Run nsrim -X two times after saveset delete
# 2003/07/24 EIS Added chi-backup_free_recycle_ssid.ksh at the end of this script
# 2003/01/16 EIS Changed selection from savetime to sscomp
# savetime is client side date / time stamp
# sscomp is server side
# 2004/02/11 EIS Changed numberofdays= from 14 to days
# ################################################################################################
rcx=0
PID=$$
tmpfile=/tmp/$(basename $0)_tmpfile.${PID}
tmpvalidclonepool=/tmp/$(basename #0)_validclonepools.${PID}
tmpmessage=/tmp/$(basename $0)_message.${PID}
numberofdays=14
numberofdays=10
mailto=root
# ##############################################################################
ck_for_valid_clone_pool () {
good_pool='bad'
if [ -z $pool ]; then
return
fi
nsradmin -i - <<EOF | grep name: | tr -d \; | cut -d: -f2 > $tmpvalidclonepool
. type: nsr pool; pool type:Backup Clone
show name
print
EOF
while read valid_clone_pools; do
if [ "$pool" = "$valid_clone_pools" ]; then
echo "Good Clone pool $pool "
good_pool=ok
break
fi
done < $tmpvalidclonepool
return
}
#
ck_for_running_savegrp () {
CT=1
while [ `ps -ef|grep -c 'root .*savegrp'` -gt 1 ] ; do
if [ $CT -gt 10 ] ; then
echo "$(basename $0) Never started because backups were running all night! $(ps -ef|grep 'root .*savegrp' ) " > $tmpdisplay_message
display_message A
exit 69
fi
sleep 900
CT=`expr $CT + 1`
done
}
display_message () {
case $1 in
A|a) message_level="ALERT";;
I|i) message_level="INFORMATION";;
W|w) message_level="WARNING";;
*) message_level="";;
esac
if [ -r $tmpmessage -a -w $tmpmessage ]; then
:
else
echo "$(basename $0) Error in calling display_message function "
exit 69
fi
mailx -s"$message_level $(basename $0) $(uname -n) $message_level " $mailto < $tmpmessage
cat $tmpmessage
rm $tmpmessage
}
# ##############################################################################
# Main Line Starts Here #
# ###############################################################################
. /.profile
#
pool="$1"
#
# Verify the pool specified is really a Clone pool
ck_for_valid_clone_pool
if [ "$good_pool" = "bad" ]; then
echo "Invalid Clone pool Specified $pool " > $tmpmessage
echo "Script Terminated " >> $tmpmessage
display_message W
return
fi
#
# Verify no save Groups are Running
#ck_for_running_savegrp
#
# Select clone pool entries
mminfo -a -ot -q"!manual,volaccess<5 days ago,pool=$pool,sscomp<$numberofdays days ago" -r'ssid,cloneid,volume(6),client,savetime(19),pool' > $tmpfile
#
# Delete Clone (savesetid/cloneid) from the Media database and Client file Index
#
if [ -s $tmpfile ]; then
echo "Total Clone savesets to purge is $(wc -l $tmpfile) "
echo "Deleting Clone save sets from Media Database "
echo " "
while read ssid cloneid volume dummy; do
echo ".\c"
if [ "$ssid" = "ssid" ]; then
:
else
nsrmm -d -v -y -S${ssid}/${cloneid}
if [ $? -ne 0 ]; then
echo " Error nsrmm -d -v -y -S${ssid}/${cloneid} "
echo "Will try again in 10 sec "
sleep 10
nsrmm -d -v -y -S${ssid}/${cloneid}
if [ $? -ne 0 ]; then
echo " Error nsrmm -d -v -y -S${ssid}/${cloneid} "
echo "Will try one more time in 10 sec"
sleep 10
nsrmm -d -v -y -S${ssid}/${cloneid}
fi
fi
fi
done < $tmpfile
# Mark the Original saveset as Not-Suspect
echo " "
echo "Marking Orginal save set -if no more clones exist- to notsuspect"
while read ssid dummy; do
echo "_\c"
if [ "$ssid" = "ssid" ]; then
continue
fi
mminfo -q"ssid=$ssid,copies=1" -r'ssid,cloneid,client,pool,copies' 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
nsrmm -onotsuspect -v -y -S${ssid}
fi
done < $tmpfile
fi
echo "Run nsrim -X two times"
nsrim -X 1>/dev/null 2>&1
echo ...
nsrim -X 1>/dev/null 2>&1
# Flag any of the specified Clone pool volumes as recycleable if there are
# no savesets on the volumes
#
echo "Recycling Clone volumes with zero savesets"
mminfo -a -q"!manual,!volrecycle,pool=$pool" -r'volume,savesets' | while read volume savesets; do
if [ "$volume" = "volume" ]; then
:
else
if [ $savesets -eq 0 ]; then
echo " nsrmm -y -orecyclable $volume "
nsrmm -y -onotreadonly $volume
nsrmm -y -orecyclable $volume
fi
fi
done
rm $tmpfile
exit 0
# ######################################### End Of Script #####################
Ed Skolnik