Home » RDBMS Server » Backup & Recovery » How to send an email once a EXP has been taken ...
How to send an email once a EXP has been taken ... [message #176461] Thu, 08 June 2006 06:47 Go to next message
frank.svs
Messages: 162
Registered: February 2006
Senior Member
Hi Team,


I've written a Daily backup script which is batch file.
This takes the logical bkp and places all the backup dump files in the directory path "D:\BACKUPs". The Database is running on Windows 2003 Server Platform.

I looks like this .


bkp.bat
------
d:
cd backups
set Today=%DATE:~-10%
set Month=%Today:~0,2%
set Day=%Today:~3,2%
set Year=%Date:~10,4%
set hh=%TIME:~0,2%
set mi=%TIME:~3,2%
set dirname=%Year%_%Month%_%Day%
set expfile=%Year%_%Month%_%Day%_%hh%%mi%.dmp
set logfile=%Year%_%Month%_%Day%_%hh%%mi%.log
d:
cd backups
md %dirname%
cd %dirname%
exp userid=uname/pwd@servicename FILE=%expfile% LOG=%logfile% CONSISTENT=Y



All that i want is that, is there any cmd to send an email once the backup is taken . I should be able to write it within this script itself. If anyone knows.Please help me out.

Thanks in Advance.
Re: How to send an email once a EXP has been taken ... [message #176464 is a reply to message #176461] Thu, 08 June 2006 06:51 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Long time ago, i used blat. Have no idea what the status is now.
http://www.blat.net/194/

[Updated on: Thu, 08 June 2006 06:51]

Report message to a moderator

Re: How to send an email once a EXP has been taken ... [message #176609 is a reply to message #176461] Thu, 08 June 2006 21:37 Go to previous messageGo to next message
hmatijaca
Messages: 2
Registered: April 2005
Junior Member
on unix I use this and works


#!/bin/ksh
#
# Oracle database backup script
#
. ~oracle/.profile
DB_INSTANCE=$1
if [[ -z ${DB_INSTANCE} ]]; then
echo "Usage $0 <DB_instance_name>"
exit 1
fi
ORAID=backup/backup
MAIL=test@email.com
CCMAIL=test@eamil.com
HOST=`hostname`
SUBJECT="Database <${DB_INSTANCE}> backup report"
ORA_SERVER=`ps -fu ${LOGNAME} -o comm | /usr/xpg4/bin/grep -x "ora_\(.*\)_${DB_I
NSTANCE}" | grep -v "grep"| wc -l`
if [[ ${ORA_SERVER} -eq 0 ]]; then
SUBJECT="No Oracle <${DB_INSTANCE}> instance is running on $HOST"
cat /dev/null | /usr/bin/mail -s "${SUBJECT}" -c ${CCMAIL} ${MAIL}
exit 1
fi
case ${DB_INSTANCE} in
NAME )
esac

Exp_dir=/mydirectory
Full_exp_file=${Exp_dir}/exp_full_${DB_INSTANCE}.dmp
Exp_file=${Exp_dir}/exp_full_${DB_INSTANCE}.dmp
Exp_log_file=${Exp_dir}/exp_full_${DB_INSTANCE}.log
Pipe_name=/tmp/pipe_exp_full_${DB_INSTANCE}
if [[ -a ${Pipe_name} ]]; then
echo "Pipe file ${Pipe_name} already exists !"
fi

$ORACLE_HOME/bin/exp ${ORAID} full=y statistics=none direct=y compress=n file=$
{Full_exp_file} log=${Exp_log_file} >>/dev/null 2>&1
echo "Finished export by "`date`>> ${Exp_log_file} 2>&1

cat ${Exp_log_file} | mailx -s "${SUBJECT}" -c ${CCMAIL} ${MAIL}
Re: How to send an email once a EXP has been taken ... [message #176783 is a reply to message #176609] Fri, 09 June 2006 10:19 Go to previous messageGo to next message
frank.svs
Messages: 162
Registered: February 2006
Senior Member

Hi Pals,

I need to send the mail in Windows batch file. So how to do it inside .BAT file. I have done it on Solaris Bkp script. But this time i also wanted it send a mail after finishing logical bkp in .bat file.

Thanks and Regards,
frank.


Re: How to send an email once a EXP has been taken ... [message #176786 is a reply to message #176783] Fri, 09 June 2006 10:32 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
did you even care to look into link i have provided?
Re: How to send an email once a EXP has been taken ... [message #177904 is a reply to message #176461] Sat, 17 June 2006 10:47 Go to previous message
frank.svs
Messages: 162
Registered: February 2006
Senior Member
Sorry for that mahesh.I was engaged with some other work. I have seen the that link. It helped me to some extent.
Thank you very much.
Previous Topic: How can i take the incremental and differential backup?
Next Topic: Unable to open tempfile for OUT_PUT
Goto Forum:
  


Current Time: Fri Mar 29 05:13:13 CDT 2024