Unsolved

This post is more than 5 years old

1226

April 13th, 2015 11:00

Verifying log files backed up with script

My customer is trying to make sure that log files in db2 are backed up to the networker server prior to removing the old files from the mount point. They have a script developed, but it is giving inconsistent results when checked against another command. I am including the commands used and sample output below. Does anyone have any suggestions? Thanks in advance.

trying to list out the log files that were backed up through networker. Not the list does not seem matching the list displayed through recover. The idea is to list all the backed up files using commands in shell script and compare them with local files and then delete the matching(backed up) files from local disk. But the commands seems not giving accurate results all the time… or maybe they are actually not backed up

On server, this is what was tried:

mminfo -s nw_server -qclient=`hostname` -q "name=/db2/SG1/log_archive,savetime>=4 days ago" -r "savetime(22),nsavetime, ssflags" | sort –n

o/p is –

     date time      save time ssflags

     03/30/15 05:02:54 1427706174 vF

     03/31/15 05:02:44 1427792564 vF

     04/01/15 05:02:29 1427878949 vF

     04/02/15 05:02:39 1427965359 vF

And then placing these save points in a file and then running the below logic…

[db2sg1@server]/db2/SG1/db2home/scripts>cat test.sh

#!/usr/bin/ksh

while read a b c d e

do

/usr/bin/nsrinfo -s `cat /nsr/res/servers` -t $c `hostname` | grep -i log  | sort -n |grep S00 >> listfiles.out

done < readfile.out

exit 0

here is the o/p of the script ----   Lots of sequence gaps in this o/p

[db2sg1@server]/db2/SG1/db2home/scripts>cat listfiles.out

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000477.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000490.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000491.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000492.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000498.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000500.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000513.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000514.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000515.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000517.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000520.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000523.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000536.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000537.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000538.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000542.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000547.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000550.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000563.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000564.LOG

/db2/SG1/log_archive/db2sg1/SG1/NODE0000/LOGSTREAM0000/C0000003/S0000565.LOG

And below is the list from recover command,

recover> ls -l

total 4365108

-rw-r----- db2sg1 43976927 Mar 28 04:45 S0000453.LOG

-rw-r----- db2sg1 39840168 Mar 28 06:00 S0000454.LOG

-rw-r----- db2sg1       18058340 Mar 28 06:11 S0000455.LOG

-rw-r----- db2sg1 44350388 Mar 28 08:30 S0000457.LOG

-rw-r----- db2sg1 44571341 Mar 28 10:45 S0000459.LOG

-rw-r----- db2sg1 40276988 Mar 28 12:00 S0000460.LOG

-rw-r----- db2sg1 41218056 Mar 28 14:15 S0000462.LOG

-rw-r----- db2sg1 44281008 Mar 28 15:15 S0000463.LOG

-rw-r----- db2sg1 39974651 Mar 28 16:25 S0000464.LOG

-rw-r----- db2sg1 40090833 Mar 28 18:30 S0000466.LOG

-rw-r----- db2sg1 44149378 Mar 28 19:45 S0000467.LOG

-rw-r----- db2sg1 39623527 Mar 28 22:00 S0000469.LOG

-rw-r----- db2sg1 44230014 Mar 28 22:47 S0000470.LOG

-rw-r----- db2sg1 44052907 Mar 29 00:00 S0000471.LOG

-rw-r----- db2sg1 62809257 Mar 29 00:30 S0000472.LOG

-rw-r----- db2sg1       42511425 Mar 29 02:45 S0000474.LOG

-rw-r----- db2sg1       44329823 Mar 29 03:45 S0000475.LOG

-rw-r----- db2sg1       18728478 Mar 29 06:34 S0000478.LOG

-rw-r----- db2sg1 44872455 Mar 29 07:30 S0000479.LOG

-rw-r----- db2sg1 39044423 Mar 29 08:45 S0000480.LOG

-rw-r----- db2sg1 44320443 Mar 29 09:45 S0000481.LOG

-rw-r----- db2sg1 39944395 Mar 29 11:00 S0000482.LOG

-rw-r----- db2sg1 44613210 Mar 29 12:00 S0000483.LOG

-rw-r----- db2sg1 41903847 Mar 29 13:15 S0000484.LOG

-rw-r----- db2sg1 44155389 Mar 29 14:15 S0000485.LOG

-rw-r----- db2sg1 42744463 Mar 29 15:21 S0000486.LOG

-rw-r----- db2sg1 41495707 Mar 29 16:30 S0000487.LOG

-rw-r----- db2sg1 44408664 Mar 29 17:30 S0000488.LOG

-rw-r----- db2sg1       39281591 Mar 29 18:45 S0000489.LOG

-rw-r----- db2sg1       39576372 Mar 29 23:15 S0000493.LOG

-rw-r----- db2sg1 52242106 Mar 30 00:00 S0000494.LOG

-rw-r----- db2sg1 62547614 Mar 30 00:45 S0000495.LOG

-rw-r----- db2sg1       40430282 Mar 30 01:45 S0000496.LOG

-rw-r----- db2sg1 47692044 Mar 30 03:00 S0000497.LOG

-rw-r----- db2sg1       40062827 Mar 30 05:00 S0000499.LOG

-rw-r----- db2sg1        9075788 Mar 30 06:19 S0000501.LOG

-rw-r----- db2sg1 39595164 Mar 30 07:45 S0000502.LOG

-rw-r----- db2sg1 44123046 Mar 30 08:45 S0000503.LOG

-rw-r----- db2sg1 39803118 Mar 30 10:00 S0000504.LOG

-rw-r----- db2sg1 44165264 Mar 30 10:45 S0000505.LOG

-rw-r----- db2sg1 40561516 Mar 30 12:10 S0000506.LOG

-rw-r----- db2sg1 44091979 Mar 30 13:00 S0000507.LOG

-rw-r----- db2sg1 41496819 Mar 30 14:15 S0000508.LOG

-rw-r----- db2sg1 43742277 Mar 30 15:15 S0000509.LOG

-rw-r----- db2sg1 43436813 Mar 30 16:22 S0000510.LOG

-rw-r----- db2sg1       41163895 Mar 30 17:30 S0000511.LOG

-rw-r----- db2sg1 47376567 Mar 30 18:30 S0000512.LOG

-rw-r----- db2sg1       44782161 Mar 30 23:00 S0000516.LOG

-rw-r----- db2sg1       63561465 Mar 31 00:30 S0000518.LOG

-rw-r----- db2sg1       45535297 Mar 31 01:30 S0000519.LOG

-rw-r----- db2sg1       44476824 Mar 31 03:45 S0000521.LOG

-rw-r----- db2sg1 40271489 Mar 31 04:53 S0000522.LOG

-rw-r----- db2sg1 43478385 Mar 31 06:00 S0000523.LOG

-rw-r----- db2sg1 6732845 Mar 31 06:10 S0000524.LOG

-rw-r----- db2sg1 44555438 Mar 31 07:00 S0000525.LOG

-rw-r----- db2sg1 39962088 Mar 31 08:15 S0000526.LOG

-rw-r----- db2sg1 45098185 Mar 31 09:15 S0000527.LOG

-rw-r----- db2sg1 50485159 Mar 31 10:00 S0000528.LOG

-rw-r----- db2sg1       60375778 Mar 31 10:03 S0000529.LOG

-rw-r----- db2sg1 61307501 Mar 31 10:06 S0000530.LOG

-rw-r----- db2sg1 44227796 Mar 31 11:06 S0000531.LOG

-rw-r----- db2sg1 43458254 Mar 31 12:15 S0000532.LOG

-rw-r----- db2sg1       45152157 Mar 31 13:15 S0000533.LOG

-rw-r----- db2sg1 39984026 Mar 31 14:30 S0000534.LOG

-rw-r----- db2sg1 45510441 Mar 31 15:17 S0000535.LOG

-rw-r----- db2sg1 43313196 Mar 31 16:30 S0000536.LOG

-rw-r----- db2sg1 45659906 Mar 31 17:22 S0000537.LOG

-rw-r----- db2sg1 43657438 Mar 31 18:30 S0000538.LOG

-rw-r----- db2sg1 44664740 Mar 31 19:28 S0000539.LOG

-rw-r----- db2sg1 43734722 Mar 31 20:30 S0000540.LOG

-rw-r----- db2sg1 42262550 Mar 31 21:30 S0000541.LOG

-rw-r----- db2sg1 45858503 Mar 31 22:30 S0000542.LOG

-rw-r----- db2sg1 41874849 Mar 31 23:30 S0000543.LOG

-rw-r----- db2sg1 54865152 Apr 01 00:00 S0000544.LOG

-rw-r----- db2sg1 60986247 Apr 01 00:45 S0000545.LOG

-rw-r----- db2sg1       44701051 Apr 01 01:41 S0000546.LOG

-rw-r----- db2sg1 46767987 Apr 01 02:35 S0000547.LOG

-rw-r----- db2sg1 42131560 Apr 01 03:45 S0000548.LOG

-rw-r----- db2sg1 45295591 Apr 01 04:45 S0000549.LOG

-rw-r----- db2sg1 40035980 Apr 01 05:49 S0000550.LOG

-rw-r----- db2sg1 26141768 Apr 01 06:11 S0000551.LOG

-rw-r----- db2sg1 41959019 Apr 01 07:15 S0000552.LOG

-rw-r----- db2sg1 45543601 Apr 01 08:05 S0000553.LOG

-rw-r----- db2sg1 43033133 Apr 01 09:15 S0000554.LOG

-rw-r----- db2sg1 45261648 Apr 01 10:03 S0000555.LOG

-rw-r----- db2sg1 43981234 Apr 01 11:15 S0000556.LOG

-rw-r----- db2sg1 44493261 Apr 01 12:06 S0000557.LOG

-rw-r----- db2sg1 44950435 Apr 01 13:14 S0000558.LOG

-rw-r----- db2sg1       43300392 Apr 01 14:10 S0000559.LOG

-rw-r----- db2sg1 48650471 Apr 01 15:00 S0000560.LOG

-rw-r----- db2sg1 41255559 Apr 01 16:15 S0000561.LOG

-rw-r----- db2sg1 45050698 Apr 01 17:15 S0000562.LOG

-rw-r----- db2sg1 40102660 Apr 01 18:20 S0000563.LOG

-rw-r----- db2sg1 45043851 Apr 01 19:15 S0000564.LOG

-rw-r----- db2sg1 43277220 Apr 01 20:26 S0000565.LOG

-rw-r----- db2sg1 41349860 Apr 01 21:30 S0000566.LOG

-rw-r----- db2sg1 42960360 Apr 01 22:32 S0000567.LOG

-rw-r----- db2sg1 42906439 Apr 01 23:45 S0000568.LOG

-rw-r----- db2sg1 67588634 Apr 02 00:02 S0000569.LOG

-rw-r----- db2sg1 47371818 Apr 02 01:00 S0000570.LOG

-rw-r----- db2sg1 42036634 Apr 02 02:15 S0000571.LOG

-rw-r----- db2sg1       44051826 Apr 02 03:15 S0000572.LOG

-rw-r----- db2sg1 39537337 Apr 02 04:30 S0000573.LOG

Many of the files missing in the sequence not showing in both (script commands and recover command) the cases, so many files missing in the list from script command.Highlighted the gaps as above

4 Operator

 • 

14.3K Posts

April 13th, 2015 12:00

Without using your script, have you verified outputs manually when using nsrinfo?  For example,

nsrinfo -t 1427706174 $clientname > ssid.1427706174

nsrinfo -t 1427792564 $clientname > ssid.1427792564

nsrinfo -t 1427878949 $clientname > ssid.1427878949

nsrinfo -t 1427965359 $clientname > ssid.1427965359


and then grep missing stuff to see if they are in any.  If not, do nsrinfo for whole client and grep missing log and see what timestamp does it have. 


You didn't say how they do backup, but I assume some kind of fs backup and no module used?  As with module, you must also use slightly different nsrinfo.

April 13th, 2015 13:00

Hrvoje,

When I run the nsrinfo by itself, it does return the entire list of log files that recovery shows. So, my guess is that the original mminfo query is not returning all the correct savetimes for some reason, since the missing log files have different savetimes from the ones originally searched for. Any thoughts? Thanks for the help.

David

April 13th, 2015 13:00

Hrvoje,

When I run the nsrinfo by itself, it does return the entire list of log files that recovery shows. So, my guess is that the original mminfo query is not returning all the correct savetimes for some reason, since the missing log files have different savetimes from the ones originally searched for. Any thoughts? Thanks for the help.

David

4 Operator

 • 

14.3K Posts

April 13th, 2015 18:00

With nsrinfo you used nsavetime returned by mminfo - so mminfo part is ok.  You can add set -vx to your script and capture output to see more closely from where does discrepancy come from.

April 14th, 2015 08:00

Issue I am seeing with the mminfo part is it is only reporting one savetime per day, when there can be more than one, which is leading to the missing entries in the nsrinfo output. I have not seen this behavior before. Any ideas? Thanks again.

4 Operator

 • 

14.3K Posts

April 15th, 2015 04:00

No, I never seen that, but you can add -av to mminfo just to be safe.

No Events found!

Top