Veritas-bu

Re: [Veritas-bu] RMAN backup status

2009-01-12 15:09:33
Subject: Re: [Veritas-bu] RMAN backup status
From: ckstehman AT pepco DOT com
To: VERITAS-BU AT mailman.eng.auburn DOT edu
Date: Mon, 12 Jan 2009 14:55:26 -0500

Here is a script I wrote in perl to scan the RMAN output logs and send an e-mail to certain users.  The input file is the file produced by the RMAN backup script supplied by Symantec (veritas)
modified for our environment.


#!/usr/bin/perl
# file: logscan
# This program will scan the output from the RMAN backup scripts and
# generate a report showing the results of the backup
#
# =====================================================================
require "ctime.pl";
$noap=1;
$logfile="hotlogs";
$mail_out="mail_out";  # output file
$fromaddr="";
$mailaddr="";
$ccaddr="";
$errflag=0;
$endflag=0;

# Get input file name if specified

if ($ARGV[0] ne "" ) {
$logfile=$ARGV[0];
}

if ($ARGV[1] ne "" ) {
$mail_out=$ARGV[1];
}
$begflag=0;

open (DOUT, "date | ") || die "Can't run date!";
while (<DOUT>){
$dout=$_;
}
close (DOUT);

open (HOUT, "hostname | ") || die "Can't run hostname!";
while (<HOUT>){
$hout=$_;
}
close (HOUT);


############################# Section 1 ########################
#
open (LOGINP, $logfile ) || die " can't open log file ";
 open(EXPUT,">$mail_out") || die "Can't open mail output file \n";

print (EXPUT "From:",$fromaddr,"\n");
print (EXPUT "To:",$mailaddr,"\n");
print (EXPUT "Cc:",$ccaddr,"\n");
print (EXPUT "Subject: RMAN backup report \n");
print (EXPUT "\n Hostname: ",$hout," Date: ",$dout,"\n");
print (EXPUT "  =====================================================\n");
############################################################

FILE:
while (<LOGINP>) {

if ($errflag != 0 || $endflag != 0 )
  {
    print (EXPUT "",$_,"");
    next FILE; }

# Print the first line of the file.
 if ( $begflag == 0 )
   {
    print (EXPUT "",$_,"");
   $begflag++;
    next FILE;
    }

# split the input record on colon

@inrec = split (/:/,$_);

if ($inrec[0] eq "ORACLE_SID" ) {
    print (EXPUT "",$_,"");
    $orasid=$inrec[1];
    next FILE;
     }
$nb_ora=substr($inrec[0],0,6);

if ($nb_ora eq "NB_ORA" ) {
    print (EXPUT "",$_,"");
    next FILE; }


 if ( $inrec[0] eq "RMAN-00569" ){
     $errflag++; # signal that an error has been found
    print (EXPUT "\n ***** Error found *** \n");
    print (EXPUT "",$_,"");
     next FILE; }

  $complete=substr($_,17,9);
 if ($complete eq "complete." ) {
     print (EXPUT "\n ******** No errors found  - ",$orasid,"\n");
    print (EXPUT "",$_,"");
     $endflag++;
     next FILE;
      }
     next FILE;
} # end of while statement for reading input

print (EXPUT " \n  =====================================================\n");
close (EXPUT);
close (LOGINP);

#########################################################
exit;
----------------------------------
Carl Stehman
Distributed Services
Pepcoholdings, Inc.
701 Ninth St NW
Washington DC 20068
202-331-6619
------------------------------------





nbujohnson <netbackup-forum AT backupcentral DOT com>
Sent by: veritas-bu-bounces AT mailman.eng.auburn DOT edu

01/10/2009 08:26 AM
Please respond to
VERITAS-BU AT mailman.eng.auburn DOT edu

To
VERITAS-BU AT mailman.eng.auburn DOT edu
cc
Subject
[Veritas-bu]  RMAN backup status






Hi All,

I am using netbackup-rman template to backup our oracle databases & i am need of a script which will give me status report of rman failures (includes client name ,db name date/time & error output etc).

Please let me know if anyone using any script like this.

Thanks,
John

+----------------------------------------------------------------------
|This was sent by nbujohnson AT googlemail DOT com via Backup Central.
|Forward SPAM to abuse AT backupcentral DOT com.
+----------------------------------------------------------------------


_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu



This Email message and any attachment may contain information that is proprietary, legally privileged, confidential and/or subject to copyright belonging to Pepco Holdings, Inc. or its affiliates ("PHI"). This Email is intended solely for the use of the person(s) to which it is addressed. If you are not an intended recipient, or the employee or agent responsible for delivery of this Email to the intended recipient(s), you are hereby notified that any dissemination, distribution or copying of this Email is strictly prohibited. If you have received this message in error, please immediately notify the sender and permanently delete this Email and any copies. PHI policies expressly prohibit employees from making defamatory or offensive statements and infringing any copyright or any other legal right by Email communication. PHI will not accept any liability in respect of such communications.
_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu