Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Error when running sqplus script in a crontab
[This followup was posted to comp.databases.oracle.misc and a copy was
sent to the cited author.]
When running a script under cron, your environment isn't automatically sourced; therefore, none of the environment variables that oracle needs to run are set (ORACLE_SID, ORACLE_PATH, ORACLE_HOME, etc, etc). The easiest way to do this is to create a wrapper script around your sqlplus script and run the wrapper from cron. The wrapper would look something like:
#/bin/ksh
# wrapper script
. /home/dkoleary/.profile
sqlplus dkoleary/mypwd @/home/dkoleary/oracle/scripts/myscript
# end wrapper
--