Forum Discussion

Prashant2's avatar
Prashant2
Level 2
10 years ago

Need help to Verify Backup image copy & expiration activity.

Hello Guys

I  have 2 backup copies in my setup ,   copy 1 ( primary )  on DATA DOMAIN ,  Copy 2 on Tape Library.

Now due to space issue on data domain  , we are expiring   Primary copy ( Copy 1 ) which was there more than 15 Days .

I have list of Backup id's for which I need to check no. of Backup copies.

(1)  if no. of backup copies are 2 .. then go for expiration of Primary copy ( which resides on DATA DOMAIN )

(2)  if no. of backup copy is 1 .. then first run duplicate job for such backup images, create 2nd copy and then expire 1st copy.

 

ISSUE ::

I tried to run below script to get no. of copies for each backup id, but i also want to know the backup ID with respect to No. of backup copies output. & want to get that output in text file. so that I can Identify the Backup id's which has only one backup id.

 

Current script & output is as below ::

cat filename.txt | while read line

> do

> bpimagelist -backupid $line -L | grep Copies

> done

***  filename.txt is the file which contains only Backup ID's for validation

*** I am expecting output as below e.g   
e.g

ABC_1416513707  =  Number of Copies:  2

DEF_1416809895  =  Number of Copies : 1

 

can some one help me in this scripting part. ?

  • Hello

    You can use the following method. Its not perfect and assumes that copy 1 is always to DD and copy 2 is always to TAPE.

    From my system i run the below and it shows me the ($1) backup image, ($2) the number of copies, and ($3) which copy is the primary. (I assume if the primary is copy 2 that copy 1 has expired already)

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }'
    app-01_1421910940 2 1
    app-01_1421909951 1 1
    app-01_1421909909 2 1
    app-01_1421909472 1 1
    app-01_1421909356 2 1
    app-01_1421220589 1 1
    ora11g-01_1421911402 2 1
    ora11g-01_1421911363 2 1
    ora11g-01_1421911306 2 1
    ora11g-01_1421911110 2 1
    ora11g-01_1421911084 0 0
    ora11g-01_1421909914 1 1
    ora11g-01_1421909473 1 1

     

    From the information above we can have a few scenarios

    1 1 which means there is one copy and copy 1 (DD) is primary. We want to duplicate these images

    1 2 which means there is one copy and copy 2 (Tape) is primary. No Action here.

    2 1 which means there are two copies and copy 1 (DD) is  primary (as its not expired). We want to expire copy 1

    2 2 which means there are two copies and copy 2 (Tape) is  primary. We want to expire copy 1

     

    The test for the scenarios are

     

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }' | awk '{ if ( $2 == 2 && $3 == 1 ) print "expire copy 1 of "$1 }'
    expire copy 1 of app-01_1421910940
    expire copy 1 of app-01_1421909909
    expire copy 1 of app-01_1421909356
    expire copy 1 of ora11g-01_1421911402
    expire copy 1 of ora11g-01_1421911363
    expire copy 1 of ora11g-01_1421911306
    expire copy 1 of ora11g-01_1421911110

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }' | awk '{ if ( $2 == 2 && $3 == 2 ) print "expire copy 1 of "$1 }'

     

    No results

     

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }' | awk '{ if ( $2 == 1 && $3 == 2 ) print "copy 2 of "$1" is the primary copy - no action required" }'

    No results

     

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }' | awk '{ if ( $2 == 1 && $3 == 1 ) print "Single copy of "$1" exists - duplicate to tape" }'
    Single copy of app-01_1421909951 exists - duplicate to tape
    Single copy of app-01_1421909472 exists - duplicate to tape
    Single copy of app-01_1421220589 exists - duplicate to tape
    Single copy of ora11g-01_1421909914 exists - duplicate to tape
    Single copy of ora11g-01_1421909473 exists - duplicate to tape

     

     

    You can replace what ever is the print section. I just put the text in there "expire" or "duplicate" to show what needs to be done. Or just print $1 > expire.file.list or > duplicate.file.ist

     

    Hope that helps.

     

4 Replies

  • Or else .. Please help me out to  Create a scirpt in such a way that, it should gather the backup id's from the givent list,  who has only single backup copy.

  • Hello

    You can use the following method. Its not perfect and assumes that copy 1 is always to DD and copy 2 is always to TAPE.

    From my system i run the below and it shows me the ($1) backup image, ($2) the number of copies, and ($3) which copy is the primary. (I assume if the primary is copy 2 that copy 1 has expired already)

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }'
    app-01_1421910940 2 1
    app-01_1421909951 1 1
    app-01_1421909909 2 1
    app-01_1421909472 1 1
    app-01_1421909356 2 1
    app-01_1421220589 1 1
    ora11g-01_1421911402 2 1
    ora11g-01_1421911363 2 1
    ora11g-01_1421911306 2 1
    ora11g-01_1421911110 2 1
    ora11g-01_1421911084 0 0
    ora11g-01_1421909914 1 1
    ora11g-01_1421909473 1 1

     

    From the information above we can have a few scenarios

    1 1 which means there is one copy and copy 1 (DD) is primary. We want to duplicate these images

    1 2 which means there is one copy and copy 2 (Tape) is primary. No Action here.

    2 1 which means there are two copies and copy 1 (DD) is  primary (as its not expired). We want to expire copy 1

    2 2 which means there are two copies and copy 2 (Tape) is  primary. We want to expire copy 1

     

    The test for the scenarios are

     

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }' | awk '{ if ( $2 == 2 && $3 == 1 ) print "expire copy 1 of "$1 }'
    expire copy 1 of app-01_1421910940
    expire copy 1 of app-01_1421909909
    expire copy 1 of app-01_1421909356
    expire copy 1 of ora11g-01_1421911402
    expire copy 1 of ora11g-01_1421911363
    expire copy 1 of ora11g-01_1421911306
    expire copy 1 of ora11g-01_1421911110

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }' | awk '{ if ( $2 == 2 && $3 == 2 ) print "expire copy 1 of "$1 }'

     

    No results

     

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }' | awk '{ if ( $2 == 1 && $3 == 2 ) print "copy 2 of "$1" is the primary copy - no action required" }'

    No results

     

    [root@ora11g-01 dbhome_1]# bpimagelist -hoursago 800 -l | grep IMAGE | awk '{ print $6, $21, $28 }' | awk '{ if ( $2 == 1 && $3 == 1 ) print "Single copy of "$1" exists - duplicate to tape" }'
    Single copy of app-01_1421909951 exists - duplicate to tape
    Single copy of app-01_1421909472 exists - duplicate to tape
    Single copy of app-01_1421220589 exists - duplicate to tape
    Single copy of ora11g-01_1421909914 exists - duplicate to tape
    Single copy of ora11g-01_1421909473 exists - duplicate to tape

     

     

    You can replace what ever is the print section. I just put the text in there "expire" or "duplicate" to show what needs to be done. Or just print $1 > expire.file.list or > duplicate.file.ist

     

    Hope that helps.

     

    • cklam220's avatar
      cklam220
      Level 1

      Is there a way do do this for Windows based Masters?