Veritas-bu

[Veritas-bu] croning catalog database backups

2002-12-04 22:56:07
Subject: [Veritas-bu] croning catalog database backups
From: Tim.McMurphy AT telus DOT com (Tim McMurphy)
Date: Wed, 4 Dec 2002 20:56:07 -0700
Thanks. That is good to know that it is still the same with the 4.5 binary
format. 

-----Original Message-----

There are two schools of thought on this.  One is to do it "the right way"
by making sure all backups are complete, shutting down bprd, running the
catalog backup, restarting bprd, etc.  If you want scripts for that, Curtis
Preston has a good script on storagemountain.com in the NetBackup area.
Another implementation of this would be to snapshot the catalog off
somewhere and back that up (I haven't tried this).

Stopping backups during a catalog backup works fine until your database gets
really big and you have backups running 24x7.  I don't have 3-4 hours to
shut down NetBackup to stream our 120GB of catalog off to tape ;)  So I run
the backup "as is".  Any backups "in flight" are lost but otherwise your
database is fine.  The NB database isn't a real database in the Oracle or
Informix sense.  It's just a big directory structure.

I use this method and have successfully recovered from catalog backup tapes
on many occaisions in lab/disaster recovery environments.  Veritas support
has told me it's fine to do things this way (regardless if you're in 3.4's
ASCII or 4.5's binary format).  And it's worth nothing that Veritas's own
vault product (in either 3.4 or 4.5) works this way - it doesn't stop
backups while it writes the catalog to tape.

Here's the (not stopping backups while it runs) script I use.  It's just a
fancy wrapper around bpbackupdb.  When you call bpbackupdb without
arguments, it uses the GUI settings.  This script works in 3.4 and 4.5:


#!/usr/bin/perl -w

# backupCatalog.pl
# andrew fabbro 
# a wrapper around bpbackupdb that provides logs and e-mail notifications

# People on this list get an e-mail if there is a success
@success_emails = qw ( person1 AT yourcompany DOT com person2 AT yourcompany 
DOT com );
# People on this list get an e-mail if...yes, you guessed it.  It's fine to 
# be on both lists because only one will be used (either the backup is 
# successful or not)
@problem_emails = qw ( person_who_cares AT yourcompany DOT com );

$tempfile="/tmp/backupdb.tempfile.$$";
$mailfile="/tmp/backupdb.mailfile.$$";
$logfile="/usr/local/bin/netbackup/backupNetbackupDB.log";

#
# run the backup
#

system ("/bin/time /usr/openv/netbackup/bin/admincmd/bpbackupdb > $tempfile
2>&1");
$exitStatus = $?;

#
# Check how we did
#

open (MAIL, ">$mailfile");
if ( $exitStatus != 0 ) {
        $subject="Daily Backup of NetBackup DB FAILED (exit code
$exitStatus)";
} else {
        $subject="Daily Backup of NetBackup DB SUCCEEDED"; 
}

#
# Print errors - if no errors, at least print time it took to run
#

print MAIL "$subject\n\n";
open (TEMP,"$tempfile");
while (<TEMP>) {
        print MAIL "\t$_";
}
close (TEMP);
print MAIL "\n";

#
# give 'em a bpsync, too
#

print MAIL "Here is the current status of our on-site NetBackup database
backups:\n\n";
open (BPSYNCINFO,"/usr/openv/netbackup/bin/admincmd/bpsyncinfo 2>&1 |");
while (<BPSYNCINFO>) {
        print MAIL $_;
}
close (BPSYNCINFO);
close (MAIL);

#
# Send out the mail
#

# if success, go to success_emails, if problem, problem_emails
if ( $exitStatus == 0 ) {
        @emails = @success_emails;
} else {
        @emails = @problem_emails;
}

foreach $email (@emails) {
        system ("/bin/cat $mailfile | /usr/bin/mailx -s \"$subject\"
$email");
}

#
# Note it in the log
#

$now=localtime;
open (LOG,">>$logfile");
print LOG "$now $subject\n";
close (LOG);

#
# Clean up after ourselves
#

unlink $mailfile;
unlink $tempfile;
_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu


<Prev in Thread] Current Thread [Next in Thread>