Error with Unix script
Hi,
I have a written a script: Code:
#!/usr/bin/ksh Code:
/devapp1_01/quartz/qzprod1/santosh/scripts/update_date.sh[6]: sqlplus: not found. |
cron typically has an unset path. You should either manually set the $PATH for crontab or use the full path in your script e.g. (/usr/bin/sqlplus).
Code:
which sqlplus |
the complete path for sqlplus is:
Code:
barza_uat_app1[] /devapp1_01/quartz/qzprod1 > which sqlplus should i include above complete path in script like this: Code:
#!/usr/bin/ksh |
You could also modify the path inside the script once at the top:
Code:
export PATH=$PATH:/usr/oracle/client_11g/product/11.2.0/client11g/bin |
Yes, referencing by using the full path to the executable or including it in the PATH as unSpawn suggests.
|
Thanks a lot, have modified the script as :
Code:
#!/usr/bin/ksh Thanks a lot for all your help:-) |
in the logs i got below message after putting export path in script
Code:
Error 6 initializing SQL*Plus |
Hi,
do you normally set ORACLE_HOME (and possibly other variables) in your shell? If so, they will need to be set in the cron job too. Evo2. |
crontab entry for this script is as:
Code:
10 6 * * * /devapp1_01/quartz/qzprod1/santosh/scripts/update_date.sh >>/devapp1_01/quartz/qzprod1/santosh/scripts/update_date.log 2>&1 |
Hi,
ok, let me be explicit. What is the output of the following? Code:
env | grep ORACLE |
output is:
Code:
barza_uat_app1[] /devapp1_01/quartz/qzprod1 > env|grep ORACLE |
Quote:
SAM |
ok, i have added those environment variables to my script next to PATH as:
Code:
#!/usr/bin/ksh |
Quote:
|
I am still getting the same error message:
Code:
Error 6 initializing SQL*Plus |
Hi,
do you source something to setup your environment to use the oracle db in your login shell? If so, have you consider sourcing the same thing in your cron script? Did you check your .bashrc, .profile, etc...? Evo2. |
Hi,
I have exported all the oracle env variables and it worked for today's run,Thanks a lot. i'll check another run as well. modified code: Code:
#!/usr/bin/ksh |
You're welcome.
|
script is working fine. Thanks a lot for all your help :-)
|
All times are GMT -5. The time now is 04:41 AM. |