you must explicitly do so within a shell, within your cron command.
try putting everything into another script like this:
quirks_new_script.sh:
vger's recommendation will only work if there are no "sh" incompatible commands within the .profile.
* edit * -- in fact, on my machine, cron does not interpret ~ correctly.
What I'm saying is this:
cron is run under the Bourne shell.
Your script is who-knows-which shell.
Therefore, you must create something that sets up the environment explicitly for your ORACLE script to run.
Do not assume ANYTHING is set up.
Remember: the user's .profile IS NOT USED THROUGH cron.
Last edited by quirkasaurus; 04-09-2009 at 04:48 PM..
This User Gave Thanks to quirkasaurus For This Post:
If a script executes from the command line but has issues in cron, it is possible that your environment is not getting set properly. With Oracle in particular, you need : ORACLE_SID, ORACLE_HOME set in your environment and ORACLE_HOME/bin must be concatenated to your path. This may be done for you by sourcing "oraenv" which typically resides in /usr/local/bin (check with your DBA). If you look in your .profile, it may contain the necessary steps to establish your environment. You can add these environment settings to your script, or you can source a separate file to set them.
an example. If your database SID is "prod1" and Oracle Home is /u01/app/oracle/product/10.2.0 then add the following to your Korne or Bourne shell:
Hi there,
Now I'm facing error regarding running shell script via cron.
The shell script which is required to get value from database.
Below is the main part of shell script.
#/bin/bash
#connect to database(1)
db2 connect to $database user xxxx using yyyy
#set values from... (3 Replies)
Hi Team,
When i am running the below query manually it is giving me the right output
i.e.
export PATH=/usr/sbin:/usr/bin:/sbin:/bin:$PATH
ADMIN=abc@abc.com
CPU_HIGH=`sar|awk '{print $9}'|sort -n|head -5|sed -n 5p`
CPU_MAX=`echo "scale=3; 100-$CPU_HIGH" | bc`
CPU_LOW=`sar|awk '{print... (13 Replies)
I am using following code to connect to oracle database from solaris shell script. which will try thrice to connect the database ...at the 4rth atempt it will exir=t.
count=0
while ; do
sqlplus -s $usrname/$password@dbSID <<-EOF | tee $logfile
WHENEVER OSERROR EXIT 9;
WHENEVER SQLERROR... (4 Replies)
Hi,
I have a bourne shell script that needs to login into sqlplus and execute a stored procedure. I need this shell script to be run under a user crontab.
It works fine if run under normal shell prompt.
But it gave error message in my log file when run under crontab:
SQL*Plus: Release... (4 Replies)
Hi All,
I beginner in unix, i have no idea how to set the script file using cron job every 5 second. I also want to execute automatically the output to text file.This is my script name countsys.sh and my textfile abc.txt. (6 Replies)
Hey Guys,
i was trying out a shell script which has to remove a file for every 90 mins. this is the code i came up with .
$ crontab -e file1
file1 contains
30 1 * * * * rm -r /folder1/folder2/somefile.txt
Now i need the cron to run for every 90 mins. the problem with this is... (8 Replies)
Hi,
I need help urgently for following issue. Pls help me to resolve this issue.
I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql)
I given... (6 Replies)
Hi All,
The script which i am using to SSH to remote server is working fine when i run is using ./ but when cron runs it it gives error that "ssh: not found"
please help!!! (3 Replies)
Sir,
I using the following commands in a file (part of a bigger script):
#!/bin/bash
cd /opt/oracle/bin
ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out
If I run this from the command prompt the result is:
2007-05-16
if I run it as a cron job then... (5 Replies)
I have a script which connects to different database servers using sqlplus. Is there a way by which I can run a shell command on that host from sqlplus?
I know about 'host' command but it runs script on the local machine where the original script is running. Is there a way to run command on the... (9 Replies)