RE: Getting started with RMAN

  • From: Michael Dinh <mdinh@xxxxxxxxx>
  • To: "'janine@xxxxxxxxxx'" <janine@xxxxxxxxxx>, oracle-l L <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 4 May 2010 14:55:19 -0700

Here's a shell script that I have used and have had to recover tablespace a few 
times because of crashed drives.

I elected to receive email on successful backup because at one time, the mail 
daemon was dead and no mail was coming through.

This serves as a test that email is still working.

This validates a restore can be performed from backup - restore database 
validate;

You may have to modify script a little to source the environment - oraenv


#!/bin/sh -x

DN=`dirname $0`
BN=`basename $0`
SID=${1:?"---> USAGE: $DN/$BN <ORACLE_SID>"}

ORATAB=/var/opt/oracle/oratab
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
NLS_LANG="AMERICAN_AMERICA.UTF8"
export ORATAB NLS_DATE_FORMAT NLS_LANG

ORACLE_SID=$1
ORACLE_HOME=`grep ${ORACLE_SID} $ORATAB|awk -F: '{print $2}'`
export ORACLE_SID ORACLE_HOME

day=`date '+%a'`
OUTF=/backup/log/$day.$ORACLE_SID.$BN.log
RMAN=$ORACLE_HOME/bin/rman
$RMAN msglog $OUTF > /dev/null << END
  connect target;
  configure controlfile autobackup format for device type disk to 
'/oracle_backup/${ORACLE_SID}/${ORACLE_SID}_%F.bck';
  configure channel device type disk maxopenfiles=8;
  backup as compressed backupset
  check logical database
  tag="dbf"
  filesperset 8
  format '/oracle_backup/${ORACLE_SID}/dbf_%d_%T_%U'
  plus archivelog delete input
  filesperset 16
  tag="arc"
  format '/oracle_backup/${ORACLE_SID}/arc_%d_%T_%U';
  crosscheck archivelog all;
  crosscheck backup;
  delete noprompt obsolete;
  delete noprompt expired archivelog all;
  delete noprompt expired backup;
  list backup;
  restore database validate;
  exit
END
if [ `egrep -ic 'RMAN-|error|fail' $OUTF` != 0 ]; then
  mailx -s "FAILED: $BN $ORACLE_SID" dba@xxxxxxxxx < $OUTF
else
  mailx -s "COMPLETED: $BN $ORACLE_SID" dba@xxxxxxxxx < /dev/null
fi
exit 


Michael Dinh : XIFIN
 
NOTICE OF CONFIDENTIALITY - This material is intended for the use of the 
individual or entity to which it is addressed, and may contain information that 
is privileged, confidential and exempt from disclosure under applicable laws.  
BE FURTHER ADVISED THAT THIS EMAIL MAY CONTAIN PROTECTED HEALTH INFORMATION 
(PHI). BY ACCEPTING THIS MESSAGE, YOU ACKNOWLEDGE THE FOREGOING, AND AGREE AS 
FOLLOWS: YOU AGREE TO NOT DISCLOSE TO ANY THIRD PARTY ANY PHI CONTAINED HEREIN, 
EXCEPT AS EXPRESSLY PERMITTED AND ONLY TO THE EXTENT NECESSARY TO PERFORM YOUR 
OBLIGATIONS RELATING TO THE RECEIPT OF THIS MESSAGE.  If the reader of this 
email (and attachments) is not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this communication is 
strictly prohibited. Please notify the sender of the error and delete the 
e-mail you received. Thank you.

-----Original Message-----
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Janine Sisk
Sent: Tuesday, May 04, 2010 2:41 PM
To: oracle-l L
Subject: Getting started with RMAN

Most of the feedback on my archive log deletion question (thank you for all the 
answers!) focused on making sure that your last backup is good before deleting 
any log files.  This makes perfect sense, but I would rather not write that 
script if I don't have to (define "backup is good" for all cases :).  The 
second most common piece of advice was to let RMAN do it as part of the process 
of backing up.

I just took a quick look at Oracle's Backup and Recovery doc to see what I 
would be getting myself into in using RMAN.  Since this is an Amazon EC2 
instance, there's no tape drive and my only choice is to back up to "disk" 
(really an EBS volume created for this purpose).

From a quick scan, this doc looks like most technical docs, which is to say it 
tells you all about what you can do, but not what you should do.  I don't want 
to read this entire thing from end to end and then figure out the best 
strategy;  I'm sure someone else (or quite a few someone elses) have already 
done that.

So... what's your favorite book/website/other resource on configuring RMAN for 
the first time?

Thanks in advance,

janine

--
//www.freelists.org/webpage/oracle-l


--
//www.freelists.org/webpage/oracle-l


Other related posts: