Need help to Verify Backup image copy & expiration activity.
- 10 years ago
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 1From 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 tapeYou 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.