environment setup inside cron job
I like to schedule a job to be run at 8:00pm every night, and I know very a little about cron
job, basically I just want to get the exp of the database every night. Please correct me if I
am wrong. I have the script as below:
exp system/manager file=/u02/backup/TEST/exp_TEST_full.dmp
log=/u02/backup/TEST/exp_TEST_full.log full=y direct=y
and this script is save as backup_TEST.sh and it located on:
seem like I have problem with setting the environment in my script but I used the same command to set environment when I do stuffs on the server and it worked.
Any advise of what command I should type inside the script????
exp system/manager file=/u02/backup/$ORACLE_SID/exp_$ORACLE_SID_full.dmp
log=/u02/backup/$ORACLE_SID/exp_$ORACLE_SID_full.log full=y direct=
Try out the above.
set your Oracle Home as well
When a job runs through cron is does a su to oracle without picking up any of the the Oracle profile information so all environment variables must be set explicitly in the cron script
I'm stmontgo and I approve of this message
stmongo and prince_jr,
per your advise below is my script:
exp system/manager file=/u02/backup$ORACLE_SID/exp_$ORACLE_SID_full.dmp
log=/u02/backup/$ORACLE_SID/exp_$ORACLE_SID_full.log full=y direct=y
so I save this as backup_TEST.sh and I tried to run ./backup_TEST and I got the error:
[oracle@qhoudb03 mytest]$ ./backup_TEST
bash: ./backup_TEST: bad interpreter: No such file or directory
Please advise, what's wrong here
Originally posted by ashley75
or whatever your ksh shell is located.
or, alternatively, you can setup your environment in your crontab:
# setup the environment
exp system/manager file=$FILE_STUB.dmp log=$FILE_STUB.log full=y direct=y
10 0 * * * (/bin/ksh "export ORACLE_SID=TEST; export ORAENV_ASK=NO, . $HOME/.profile; $HOME/your_export_script_goes_here.ksh")
Last edited by marist89; 10-24-2003 at 05:04 PM.
Also, you know if you don't know WHY export is a VERY poor method for a backup, use "Search".
if that does not work just give
Give the full name if you are not running from current directy
Jeff and Prince_jr,
I got my script working when I issue ./backup_TEST.sh and everything seems to work fine. Below is my script:
# full backup TEST
exp system/manager file=/u02/backup/$ORACLE_SID/exp_$ORACLE_SID_full.dmp log=/u02/backup/$ORACLE_SID/exp_$ORACLE_SID_full.log full=y direct=y
and this file is saved in :/home/oracle/DBA_STUFFS/backup_scripts/TEST/backup_TEST.sh
but I seem to have problem when I schedule this job to be run at 8:00pm every night.
below is the message I got in the mail:
From: firstname.lastname@example.org (Cron Daemon)
Subject: Cron /home/oracle/scripts/backup/TEST/backup_TEST.sh