DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: backup script (alert)

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Posts
    21

    backup script (alert)

    hello all,

    i wrote a simple scripts to backup my archive logs, this does the job. But i want to modify this to get e-mail alert only if my backup fails... How would i do that. Right now, if my backup fail or not. I get an e-mail from that box sayings its done or not... here is my scripts...could anyone modify or help me modify this, so that i get e-mail only if my backup fails..i know this has to do with something if/them cmd. But how can this be achive on the below script..

    export MMSG=/tmp/$$.mail
    export ADDR="username@domain.com"
    export ORACLE_SID=test
    export ORACLE_HOME=/u01/oracle/10g
    rm -f $$MMSG > /dev/null 2>&1
    echo "ARCHIVE BACKUP STARTED: "'date'
    echo "ARCHIVE BACKUP STARTED: "'date' > $MMSG
    /u01/oracle/10g/bin/rman target / @/home/oracle/scripts/archive_back.scr >> $MMSG 2>&1
    echo "ARCHIVE BACKUP COMPLETED: "'date'
    echo "ARCHIVE BACKUP COMPLETED: "'date' >> $MMSG
    if [ -f $MMSG ]
    then
    mailx -s "Archive Backup Status" $ADDR < $MMSG
    fi

    rm -f $MMSG > /dev/null 2>&1

    -------------------------------------------------------------------

    the other script archive_back.scr is just saying to backup archive logs..

    run {
    allocate channel t1 .....
    backup FILESPERSET=3
    (archivelog all delete input format '%t_%s_%r.dbf' channel t3);
    }
    exit
    -----------------------------------------------------------------

    want this to be modified in a way, where i only get e-mail alert if my backup fails...

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492

    Talking Exit code

    You could check for the exit code ($?) after execution of the rman command.
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

  3. #3
    Join Date
    Apr 2006
    Posts
    377
    In addition to the exit code, you can also check V$RMAN_BACKUP_JOB_DETAILS.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width