The way I do it, I put the rman script in another file then call it through the shell script. Here's my approach assuming your scripts are located in $SCRIPTS.
Main Topics
Browse All TopicsListed below you will find my RMAN Shell script. I need to add the logfile results of this RMAN script to the email function whether it succeeds or fails. Any simple recommendations?
#!/bin/ksh
#-------------------------
export ORACLE_HOME=/opt/u01/app/o
export ORACLE_SID=act1g
export PATH=$PATH:$ORACLE_HOME/bi
#-------------------------
MAIL_LIST="jdoe@act1g.com"
#-------------------------
rman nocatalog <<EOF
connect target sys/0racle10g@act1g
run {allocate channel oem_backup_disk1 type disk format '/opt/u08/orabkup/rman/ful
_%U';
BACKUP FULL
DATABASE PLUS ARCHIVELOG;
backup current controlfile format '/opt/u08/orabkup/rman/ful
backup spfile format '/opt/u08/orabkup/rman/ful
crosscheck backup;
DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 14 DAYS;
release channel oem_backup_disk1;
}
EOF
#
if [ $? -ne 0 ]; then
SUBJ="act1g RMAN Backup Failed"
TO=jdoe@act1g.com
(
cat << !
To : ${TO}
Subject : ${SUBJ}
Cc : ${CC}
!
cat << !
act1g Full RMAN Backup Failed. Please check backups.
!
#uuencode ${1} ${1}
!
) | /usr/lib/sendmail -v ${TO} ${CC}
EOF
#
else
SUBJ="act1g RMAN Backup Completed Successful"
TO=jdoe@act1g.com
(
cat << !
To : ${TO}
Subject : ${SUBJ}
Cc : ${CC}
!
cat << !
act1g Full RMAN Backup Completed Successfully.
!
#uuencode ${1} ${1}
!
) | /usr/lib/sendmail -v ${TO} ${CC}
fi
#-------------------------
date
#-------------------------
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: rolutolaPosted on 2009-04-14 at 00:31:45ID: 24135616
You need to define RMANLOG variables to point to your a designated location on server.
R.
Select allOpen in new window