-
Oracle 8.0.6
Compaq Tru64 4.0D
I am trying to RMAN backup job from cron.
The shell script I wrote works fine when run interactively but doesn't work when scheduled through cron. The log file, to which I am directing the output of the shell comes blank.
I suspect I am missing some environment variables but don't know which one? Below are my shell script and rman script.
Code:
#backup_full_db.sh
#
export ORABIN=/ora01/app/oracle/product/8.0.6/bin
export PATH=.:/ora01/app/oracle/product/8.0.6/bin:/opt/bin:/bin:/usr/bin:/usr/ccs/bin:/usr/local/bin
export ORACLE_BASE=/ora01/app/oracle
export ORACLE_SID=fdbsp
export LD_LIBRARY_PATH=/ora01/app/oracle/product/8.0.6/lib:/usr/lib
export ORACLE_HOME=/ora01/app/oracle/product/8.0.6
#
/ora01/app/oracle/product/8.0.6/bin/rman target sys/password@fdbsp rcvcat rman/rman@catlg cmdfile /ora01/app/oracle/cron/backup_ful
l_db.rman msglog /ora01/app/oracle/cron/output/backup_full_db.log
Code:
#backup_full_db.rman
run {execute script backup_full_db_al_disk;}
exit
Any idea? Appreciate all help.
Sanjay
-
Hi;
Have you tried the script starting in background
- When some errors occur cron writes a mail; have you checked this
- you manually recreate the environment, would it be possible to execute the profiles in your script
Code:
# Not forget the point-command ( exec in this shell )
. /etc/profile
. /u/...home/oracle/.profile # or .bash_profile
to get the whole environment
in cron you can explicit direct the stderr and stdout to disk
Code:
cmd > file.log 2> file.err
Hope it helps
Orca
PS.: i would appreciate to work under TRUE64!
-
Hi Orca, thanks for the response..
- No mail generated. Checked it.
- tried running .profile in the script. It also doesn't work.
- i am explicitly dircting the cron output to a log file. That log file is generated but it is blank with size 0 bytes.
I tried running the shell script interactively under root and it works. It only doesn't work when put in cron.
Any other reason??
Sanjay
-
Send me please the output of
Orca
-
Try this
Create crontab as ROOT and use:
00 01 * * 0 su -l oracle --command="/home/oracle/script.sh"
Best wishes!
Dmitri
-
excerpts from crontab for user oracle
Code:
# RMAN job to backup full database to disk everyday.
#
16 16 * * * /ora01/app/oracle/cron/backup_full_db.sh > /ora01/app/oracle/cron/output/backup_job.log
#
Hi kgb, ideally the job should work under user oracle. Though I didn't try under root.
Sanjay
[Edited by SANJAY_G on 07-12-2002 at 05:24 AM]
-
Sorry no idea !
crons looks good
Orca
-
Hi,
Look at this
http://www.geocities.com/webdbaquest...an_backup.html
In the backup-shell-script the first line specs the Shell for example.
Orca
-
A ha!!
It works now. I have added the following line at the start of the shell script and it did the trick.
#!/bin/ksh
The environment variable defined in my script were not getting executed because they were defined in korn shell format and by default the cron uses some other shell.
Thanks all for the response.
Sanjay
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|