I have a shell script, that will export two oracle database dump file. If I execute the script by hand:
. /path_to_file/backup.sh
it will work fine, but if I install it using crontab -e
@daily . /path_to_file/backup.sh
it will only execute the first export, but not the second export.
Here is that script
. /path_to_file/backup.sh
it will work fine, but if I install it using crontab -e
@daily . /path_to_file/backup.sh
it will only execute the first export, but not the second export.
Here is that script
Code:
su - oracle -c '
PATH=${PATH}:/home/oracle/oracle/product/10.2.0/db_1/bin/
ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1
ORACLE_SID=orclsvr
ORATAB=/etc/oratab
ORACLE_HOME_LISTNER=$ORACLE_BASE
ORACLE_BASE=$ORACLE_HOME
export ORACLE_BASE ORACLE_SID ORATAB ORACLE_HOME ORACLE_HOME_LISTNER
exp db_user1/db_password1 file=/home/oracle/dailybackups/db_user1.dmp log=/home/oracle/dailybackups/db_user1.log rows=yes indexes=yes
rar a /home/oracle/dailybackups/db_user1.rar /home/oracle/dailybackups/db_user1.dmp
exp db_user2/db_password2 file=/home/oracle/dailybackups/db_user2.dmp log=/home/oracle/dailybackups/db_user2.log rows=yes indexes=yes
rar a /home/oracle/dailybackups/db_user2.rar /home/oracle/dailybackups/db_user2.dmp
'