Unsolved
This post is more than 5 years old
161 Posts
0
18272
How to find last backup using mminfo
Hi guys,
I have some DBs which I backup with NetWorker every day. Once a week I need to clone the last backup to tape. I'm looking for a mminfo to create a saveset list file which I then want to give to nsrclone.
Is there a way how mminfo would only list the last backup of a group or a client. If I e.g. use "savetime>=1 day ago" hours it would probably show me some ssids which belong to the backup before the last one.
Has anyone faced a similar chanllenge?
Cheers
Jan
ble1
2 Intern
2 Intern
•
14.3K Posts
0
April 13th, 2017 00:00
You would need to expand your script by checking with nsradmin first what is the start of the group or what was last start and end time and use that to build range via mminfo. Some more detailed approach would also include check if that backup was valid or not (eg. was it successful). With mminfo itself, there is no such thing as last backup parameter as that doesn't translate to any available parameter kept within mdb.
bingo.1
2.4K Posts
0
April 13th, 2017 02:00
If you have fixed backup intervals, the mminfo command is easy because you can also use smaller time intervals. For example:
mminfo -q "client=xxx,savetime>-30mins" -r "client,name,level,savetime(25) ...."
wlee
263 Posts
0
April 13th, 2017 06:00
There is no single NetWorker command that would list you just the last time a back was done for a certain client:saveset. The closest example, filtering on group name, will report sorted in reverse chronological order:
mminfo -avotR -q "savetime>-1 week ago,valid,copies=1,group=(GROUP)" -r "client,name,savetime(20),ssid,cloneid"
To filter based on client:
mminfo -avotR -q "savetime>-1 week ago,valid,copies=1,client=(CLIENT)" -r "client,name,savetime(20),ssid,cloneid"
You could create a output file, which can then be used massage the data, and clone. The following will create an output file using a semi colon as a delimiter:
mminfo -avotR -q "savetime>-1 week ago,valid,copies=1,group=(GROUP)" -r "client,name,savetime(20),ssid,cloneid" -xc; > out.txt 2>&1
I did find the following that uses a Perl script to determine the most recent level=Full backups. Take a look, and you can modify it to suit your needs. I did not test it, but at the very least, it looks promising:
Re: [Networker] List last FULL using mminfo
https://adsm.org/lists/html/Networker/2009-09/msg00325.html
From: EMC NetWorker discussion [mailto:NETWORKER AT LISTSERV.TEMPLE DOT EDU] On
Behalf Of Davina Treiber
Sent: 29 September 2009 17:48
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Subject: Re: [Networker] List last FULL using mminfo
Here's one that I wrote a few years ago to do this.
#!/usr/bin/perl
use Getopt::Std;
my %opts;
getopts('s:', \%opts);
#$ENV{"LC_TIME"}="LC_TIME=en_GB.ISO8859-15";
$ENV{PATH}="/bin:/usr/bin:/usr/sbin:/opt/networker/bin";
open MMINFO, "mminfo -s $opts{'s'} -q \"!incomplete,level=full\" -r
\"nsavetime,savetime,client,totalsize(9),name\" |";
while ( ) {
next if /^ save time /;
($nsavetime, $savetime, $client, $size, $mult, @name) = split;
$name = join " ", @name;
if (defined $latestnsavetime{$client}{$name}) {
$l_nsavetime = $latestnsavetime{$client}{$name};
if ($nsavetime gt $l_nsavetime) {
$latestnsavetime{$client}{$name} = $nsavetime;
$latestsavetime{$client}{$name} = $savetime;
$latestsize{$client}{$name} = "$size $mult";
}
else {
};
}
else {
$latestnsavetime{$client}{$name} = $nsavetime;
$latestsavetime{$client}{$name} = $savetime;
$latestsize{$client}{$name} = "$size $mult";
};
};
for $client (sort keys %latestnsavetime) {
for $name (sort keys %{ $latestnsavetime{$client} } ) {
printf "%10s %-15s%-40s%-10s%8s\n",
$latestnsavetime{$client}{$name}, $client, $name,
$latestsavetime{$client}{$name}, $latestsize{$client}{$name};
};
};
MoinMansuri
2 Intern
2 Intern
•
147 Posts
0
April 17th, 2017 05:00
Use the below commands for your requirement :-
mminfo -avot -xc, -r "client,name,ssid,cloneid,volume,totalsize,sscreate(17),sscomp(17),sumflags,group,level,ssbrowse,ssretent,location"
Calculate between the period:-
mminfo -avot -q "savetime>=04/01/2017,savetime<=04/02/2017" -r "client,name,savetime,sscreate,ssid,cloneid,volume,location,ssretent,sumflags,level"
Check save set which was backed up on yesterday only:-
mminfo -avot -xc, -r "client,name,ssid,cloneid,volume,totalsize,sscreate(17),sscomp(17),sumflags,group,level,ssbrowse,ssretent,location" -t yesterday
Checked for particuler client:-
mminfo -s Backup Server Name -r "client,name,savetime,ssid,cloneid,volume,location,ssretent,sumflags,level" -q "client=Client Name,savetime>04/01/2017,savetime<04/02/2017" -ot
Data pulled from last 7 days:-
mminfo -avot -xc, -r "client,name,ssid,cloneid,volume,totalsize,sscreate(17),sscomp(17),sumflags,group,level,ssbrowse,ssretent,location" -t '7 days ago'
-a >> Causes queries to apply to all complete, browsable save sets, not just those in the last 24 hours.
-v >> Displays additional verbose report output
-o >> Sorts the output in the specified order
-t >> Restricts the reported information to the media and/or save sets pertaining to the save sets created on or after time.
-xc, >> displays values separated by any single character or string. For example, âmminfo -xc,â will produce comma-separated values.
-r >> attributes to be displayed for the current query
wlee
263 Posts
0
April 17th, 2017 06:00
> Check save set which was backed up on yesterday only: -t yesterday
Sorry, but this is incorrect. Using the parameter "-t yesterday" will find all savesets that were backed up since yesterday, not only yesterday