Showing results for 
Search instead for 
Did you mean: 

How to extract only backup id's of a job to a file

Level 2


We are using same policies (9) for a couple of backup's(say x,y,z). Now my requirement is to extend the retention of the 'x' backup without affecting y & z.

Using 'bpexpdate -recalculate -policy' will affect our y & z jobs as well. 

However, i know we can use here 'bpexpdate -backupid inf-nbuxx_551321 -d mm/dd/yyyy hh:mm:ss' command but there are around 500+ id's for each job.

Is there any command available to pull all the backup id's of a particular job, so that i can write a script and excute bpexpdate command for all the backup id's at one go.





There needs to be something unique to find, either client name, or schedule.  If you used the same policy, you have the same information for most of the fields. Check the bpimagelist command for specific things to select on.

It IS possible to run an image list and then recalculate the retention of specific images.

for example, I have a bunch of clients starting with facs, I needed to set the weekly schedule to a different retention.

I went to the images directory, and did this:

for x in `ls -1d facs*`
for i in `bpimagelist -idonly -d '01/01/2011' -e '03/23/2015' -client $x -sl Weekly_Full_Backup | cut -d " " -f10`
echo "Changing Backup ID: "$i at `date +%Y%m%d.%H%M`
/usr/openv/netbackup/bin/admincmd/bpexpdate -recalculate -backupid $i -copy 2 -ret 13 -force

x = list of clients

i = images

-sl = specific schedule name

-copy = copy number

-ret - retention value to set

I would DEFINITLY recommend running it with ECHO and CHECK to make sure you are selecting what you want, because once you expire or set the wrong retention, you can be potentially in BIG trouble! PLEASE PLEASE PLEASE


NetBackup on Solaris 11, writing to Data Domain 9800
duplicating via SLP to LTO5 in SL8500 via ACSLS


Once you find your script, save it to a file! I have one called NBcommands.txt that has stuff I found over the years.


# To find media to restore for oracle clients by Oracle block file - ON THE CLIENT run this command:
/usr/openv/netbackup/bin/bpclntcmd -ml /db_717_1_662950820 -ct Oracle
# if you have dates you can add -s mm/dd/yy
# To reset all logging levels for vxlog
vxlogcfg -a -p 51216 -o ALL -s DebugLevel=0 -s DiagnosticLevel=0
# To list all the -o values for netbackup (51216)
# vxlogcfg -l -p 51216
# To list values for logging
for i in `vxlogcfg -l -p 51216| grep -v ist`
echo $i >> /tmp/current.vxlog.config
vxlogcfg -l -p 51216 -o $i >> /tmp/current.vxlog.config

# error 58 - test connectivity:
bptestbpcd -verbose -debug -client <client hostname>

# when was my directory or file backed up? -t = type 19=NDMP 40=VM 29=flash-Win 20=Flash 15=SQL 13=Win 4= Oracle 0=standard (default)

bplist -C clientname -b -l -s 01/01/2014 -t 19 "/dir/shared/dir/*"

output lists dates backups ran

I have scripts saved to change tape ownership for better restores, to expire tapes, to deactivate and reactivate my policies and SLP.

# cat
# get list of active policies and save to file
# Look at the 12th field of your output.
# This will be a 1 if it is inactive and a 0 if it is active.
# bppllist POLICY -l|grep INFO | awk '{print $12}'
# step 1 - move active list!
mv /var/adm/scripts/active.policies.txt /var/adm/scripts/active.policies.`date +%Y%m%d.%H%M`
# step 2 - for all policies check if active and store name and deactivate
for i in `/usr/openv/netbackup/bin/admincmd/bppllist`
echo $i
ACTIVE=`/usr/openv/netbackup/bin/admincmd/bppllist $i -l |grep INFO | awk '{print $12}'`
if [ $ACTIVE = 1 ]
echo $POLICY" Policy is already deactivated!"
echo "Adding policy name to file - "$POLICY
echo $POLICY >> /var/adm/scripts/active.policies.txt
echo " and deactivate if active! "
/usr/openv/netbackup/bin/admincmd/bpplinfo $i -modify -inactive &

You can then just run for i in the active.policies.txt file, activate policy and put them all back. I use this everytime I need to stop all my backups.

NetBackup on Solaris 11, writing to Data Domain 9800
duplicating via SLP to LTO5 in SL8500 via ACSLS

Partner    VIP    Accredited Certified

@rakeshmalugu is this a once-off requirement?

Or something that needs to be done on a regular basis?
If so, then best to split the policies so that the relevant client and backup selection have the correct retention level.

Thank you for your response. I will try to implement your script carefully.

@Marianne This is our regular task.

We are using the same policies because we have the same requirement (storage unit, retention level etc) for number of jobs. So we dont want to create duplicate policies. So we are figuring it out to work with only backup id's when working on adhoc retention extentions.