Hi all,
I'm having this scenario which for the moment I cannot resolve.
I wrote a script to make a dump/export of the oracle database. and then put this entry on crontab to be executed daily for example.
The script is like below:
cat /home/oracle/scripts/db_backup.sh
#!/bin/ksh
#Backup export database script
#Created 05-04-2011
# * * *
DATE=`date +%d%m%Y-%H%M%S`
ARCHIVE_DIR=/home/oracle/arch
SCRIPTS_DIR=/home/oracle/scripts
USER=oracle
PASS=XXXXXXXX
(
echo "Starting database dump ..."
date
cd $ARCHIVE_DIR
exp $USER/$PASS FILE=filename_$DATE.dmp log=logfile_$DATE.log
echo "End of database dump ..."
date
) | tee $ARCHIVE_DIR/exp_logfile-$DATE.log 2>&1
Also the crontab entry:
host> crontab -l
00 11 * * * /home/oracle/scripts/db_backup.sh 2>&1
The crontab entry and also the script is executed as oracle user. When I execute directly from the shell the script is executed correctly and the dump is also generated ok.
But on the cron job I get only the log part "Starting/Stoping database dump ..." and not the export dump file and dump_log file: the "exp..." part.
What can be the problem?
Thanks
Enid