Re: HELP with CRONTAB and SQLPLUS

From: <jpivovar_at_lcp.com>
Date: 1995/11/29
Message-ID: <49il2i$s0s_at_news.tpp.com>#1/1


> pmccarth_at_rpc.unb.ca (Patrick McCarthy) writes:
 snip---
> updates. Unfortunately sqlplus does not seem to run. I know the script run
> because the file gets moved and stored in an update directory. I have run the
> script as the root user and it works. What can I do to get it to work from
> CRONTAB or is it not possible to run sqlplus from a crontab ?
>
> #! /bin/sh
 

> for i in /accounts/LC*.sql
> do
> if [ -s $i ]
> then /opt/oracle/V7/bin/sqlplus / _at_$i
> mv $i /updates/update.`date '+%m.%d.%y_:_%T'`
> sleep 1
> fi
> done

It is extremely possible, happens all the time.

You're probably missing the environment variables that oracle needs to, say, decide what database to connect you to and other little things like that.

Within the script, try setting at minimum ORACLE_SID and ORACLE_HOME. (be sure to export the variables)

Ensure that root has an externally validated account in the database (that is how you're connecting - although this is in principle a bad idea IMHO). Soapbox: set up database cron jobs to run under an app owner account.

If you get REAL frustrated, try outputting your standard error to a file so that when it runs you can review the log and see the errors that were generated.

Hope this helps.

JP Received on Wed Nov 29 1995 - 00:00:00 CET

Original text of this message