URGENT: cron job not running the sqlplus command in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting URGENT: cron job not running the sqlplus command in shell script
# 8  
Old 04-09-2009
If the file's actually in /home/dreg/sqlscript.sh then yes. Given the crazy path it had earlier though I'm skeptical.
# 9  
Old 04-09-2009
Would there is any thing that i need to check ?

I am not getting any clue on why the cron is not executing the sqlplus

Thanks
dreg
# 10  
Old 04-09-2009
verify that the script works under the cron user id out in the shell normally.

personally, i never like executing a script directly through cron and always
make sure that a specific environment is sourced into the shell running that command.

for example:

1 * * * * /acus/bin/cron_env.sh some-shell.cmd with some arguments

and cron_env.sh looks like:

. /acus/bin/set_env.sh
$*

i'm willing to bet you have environment variable issues. something's not getting set through cron.

verify that the crontab user under this job has connect permissions and read permissions tothe database and tables you're accessing, write permissions also, if necessary.

verify that every directory in your fullpaths are searchable by this user.
# 11  
Old 04-09-2009
Quote:
Originally Posted by Ikea
Would there is any thing that i need to check ?

I am not getting any clue on why the cron is not executing the sqlplus

Thanks
dreg
Is sqlscript.sh actually in /home/dreg/sqlscript.sh ?
# 12  
Old 04-09-2009
thats corrrect.
# 13  
Old 04-09-2009
what is the error message you're getting from the cron job?

have you compared the environmental variables from the normal login shell
to the cron shell used?

you know these are totally different, right?

for example, i believe ORACLE needs to access certain database information through the oranames.tns file which is stored
under an environmental variable ORACLE_ADMIN_DIR or something like that. . . .

this variable would not be set in your cron environment, unless you explicitly did so.

Last edited by quirkasaurus; 04-09-2009 at 03:16 PM.. Reason: some more accuracy in comments
# 14  
Old 04-09-2009
>>>what is the error message you're getting from the cron job?

I am not getting any error message ..it is just that the cron is overlooking the sqlplus line in the script and executes everything else


>>>for example, i believe ORACLE needs to access certain database information through the oranames.tns file which is stored
under an environmental variable ORACLE_ADMIN_DIR or something like that. . . . this variable would not be set in your cron environment, unless you explicitly did so

If i execute the script from absolute path from command line ..everything works..so i believe all the ORACLE parameters are set in .profile..

Is there anything that needs to be set specifically for cron job to work?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Troubles running DB2 command in shell script via cron

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)
Discussion started by: Rohan Kishibe
3 Replies

2. UNIX for Dummies Questions & Answers

Error while running a script through cron job

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)
Discussion started by: Ekamjot
13 Replies

3. Solaris

Error during running sqlplus command from shell script in Solaris

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)
Discussion started by: millan
4 Replies

4. Solaris

cannot execute sqlplus in shell script under cron

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)
Discussion started by: joe_x
4 Replies

5. Shell Programming and Scripting

Running script file using cron job every 5 second

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)
Discussion started by: mastercar
6 Replies

6. Shell Programming and Scripting

Cron job shell script..

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)
Discussion started by: Irishboy24
8 Replies

7. Shell Programming and Scripting

(Urgent):Creating flat file using sql script and sqlplus from UNIX Shell Script

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)
Discussion started by: praka
6 Replies

8. Shell Programming and Scripting

Cron job giving error while running SSH command

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)
Discussion started by: visingha
3 Replies

9. SuSE

inconsistent ls command display at the command prompt & running as a cron job

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)
Discussion started by: rajranibl
5 Replies

10. Shell Programming and Scripting

running shell script from sqlplus

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)
Discussion started by: dkr123
9 Replies
Login or Register to Ask a Question