Running SQLPLUS Script in CRONTAB


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running SQLPLUS Script in CRONTAB
# 8  
Old 06-15-2010
Hi Ranjithpr,

Yes I am able to execute '/home/ivbbuild/tosh.sh' from any directory. Additionally I am able to execute:
Code:
/u01/app/oracle/product/9.0.1/bin/sqlplus -s xxxx/xxxx @/home/ivbbuild/rec.sql  > /home/ivbbuild/rech.txt

from anywhere.

Also I am cron tab entry is under root user not oracle. I thought thats why we put the environment variables right?

I have also added new variables:

Code:
export TNS_ADMIN=/u01/app/oracle/product/9.0.1/network/admin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib

Please advise. Thanks in advance.

Tosh.

---------- Post updated at 12:36 AM ---------- Previous update was at 12:35 AM ----------

Hi All,

Also
Code:
 /home/ivbbuild/rech.txt 2>&1

does not yield any error logs. The rech.txt simply wont generate.

regards,
Tosh.
# 9  
Old 06-15-2010
Quote:
Also I am cron tab entry is under root user not oracle. I thought thats why we put the environment variables right?
Just as a sidenode: Even if you run it from the oracle crontab you would have to set up all environmental things like for example
Code:
. ./.profile
. ./someenv
export ...

When running a crontab, there will be no environmental stuff used like when you log in normal with that user.

If you run this script for testing purpose in the crontab of user oracle, including sourcing it's .profile and environment files, it would be interessting if it works.
If yes, then something in the environment of root might be still missing.
# 10  
Old 06-15-2010
If the permission of file '$ORACLE_HOME/bin/oracle' is not set properly then 'sqlplus' won't work for non-oracle users.

Permission of this file must be like '-rwsr-s--x'.

Regards,

Jith
# 11  
Old 06-17-2010
Hi Jith,


The permission of file '$ORACLE_HOME/bin/oracle' is set to '-rwsr-s--x' from the start.

Still no luck.

Has anyone ever run this before?

regards,
Santosh.
# 12  
Old 06-21-2010
Hi Guys,

Any more suggestions?

regards,
Santosh.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

CRONTAB - one python script is not running

Hi! I'm using a RaspberryPi with standard Raspbian. Currently I'm working on some sort of weather station. For now I have three python scripts - one which is updating txt files for website - update1m.py ( it will not be necessary in few next days so I'll delete it) , second one for updating... (4 Replies)
Discussion started by: bartocham
4 Replies

2. 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

3. Shell Programming and Scripting

Delay in running script from crontab

I am facing an issue where sometimes crontab is running script with some delay. Below is the stmt in script and it is the only stmt in script. echo "running at `date` " >> CRONCHECK.log Below is the cron entry. 0 11 * * * CRONCHECK.sh Below is the time of run each day. running at Fri... (8 Replies)
Discussion started by: Nishant Singh
8 Replies

4. UNIX for Dummies Questions & Answers

crontab not running script

Hi All, I am having the below script to be run from crontab, it it doesnt run. 1 * * * * /home/cobr_ext/test.sh > /home/cobr_ext/temp.txt when i run i manally it runs without any issues. Could please help me as to why doesnt it run the script.:( (7 Replies)
Discussion started by: abhi_123
7 Replies

5. UNIX for Advanced & Expert Users

Particular script not running through crontab

Hi, I have created the below script, set -x # Set the Path of Environment file ENV_FILE_DIR=/opt/app/p1trp1c1/sybase/ecdwqdm/xrbid/QDM_Prod/bin LOG_DIR=/opt/app/p1trp1c1/sybase/ecdwqdm/xrbid/QDM_Prod/log export ENV_FILE_DIR export LOG_DIR # Set Audit Environment . ${ENV_FILE_DIR}/QDM.env... (8 Replies)
Discussion started by: yohasini
8 Replies

6. Shell Programming and Scripting

Crontab not running a script

Hi, I posted this in the Solaris forum but I think this one would be more appropriate. I created a script starting with the following lines: #!/usr/bin/ksh flag=n export flag typeset -i quant=0 (...) When running it I'm getting the following 2 errors: /tmp/tstscript/testfail.ksh:... (9 Replies)
Discussion started by: Cvg
9 Replies

7. Shell Programming and Scripting

Problem with crontab running a script

I am trying to use the CRON utility in Fedora 11 & CentOS... I intend to run a script which pops up a warning message every hour and i made the following entry using "CRONTAB -e " * * * * * sh /bin/myscript.sh But this does not seem to be running. Another thing to note is that,... (4 Replies)
Discussion started by: Vabiosis
4 Replies

8. UNIX for Dummies Questions & Answers

Getting error when running script through crontab

Hi all, I wrote small script for Solaris and when I am running it through command prompt its ok, but when I trying to run it using crontab, i am getting error like: ld.so.1: dbloader: fatal: libACE.so: open failed: No such file or directory /tmp/file.sh: line 5: 8304 Killed ... (4 Replies)
Discussion started by: nypreH
4 Replies

9. Shell Programming and Scripting

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

cron job not running the sqlplus command in shell script but the shell script works fine from command line.. Cronjob: 5 * * * * /home/dreg/script.sh script.sh: #!/bin/ksh /oracle/u000/app/oracle/product/10204/GEN/bin/sqlplus -s <user>/<pass>@<sid/home/dreg/sqlscript.sh ... (18 Replies)
Discussion started by: Ikea
18 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