Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: I have a SQLPLUS question

Re: I have a SQLPLUS question

From: GreyWolf_69 <GreyWolf_69_at_alloymail.com>
Date: Fri, 15 Oct 1999 15:44:01 -0400
Message-ID: <38078401.5DD52490@alloymail.com>


Thanks for the information.

Actually, what I wanted to do is inside a shell script. It does set the variables but it doesn't do any error checking. So, I will use your suggestions to help do some error trapping.

Now I do have a follow up question. A response that I got to this note, via email, suggested using a little different syntax, ex:

sqlplus scott/tiger_at_sid < /mypath/myscript

will this work as well? Why the less then sign here?

thanks again,

Wolf

Kenneth C Stahl wrote:

> You should never call sqlplus directly from the cron. What you really need
> to do is put the sqlplus invocation inside a shell script and put the shell
> script on the cron. Like this:
>
> #!/bin/ksh
>
> # Redirect output
> exec >/tmp/myscript.log 2>&1
>
> # Set ORACLE_SID and ORACLE_HOME
>
> if [ -z "${ORACLE_SID}" ];then
> export ORACLE_SID=ORCL;
> export ORACLE_HOME=/oracle/app/oracle/product/7.3.4
> fi
>
> # Invoke sqlplus
> sqlplus -s scott/tiger @/mypath/myscript
> if [ $? -ne 0 ];then
> print -u2 "Fatal error from sqlplus"
> exit 1;
> fi
> exit 0;
>
> The reason you need to set ORACLE_SID and ORACLE_HOME is that these shell
> variables are probably set by your .profile and are therefore not set in
> the default environment that you'll get when you run a job from cron.
>
> GreyWolf_69 wrote:
> >
> > what is the syntax for calling a sql file from a UNIX command line.
> >
> > I have a sql script that I want to run from cron, late at night. I
> > can't seem to get the syntax correct, between user/password/sid and sql
> > file name.
> >
> > Any help would be great.
> >
> > Thanks alot.
> >
> > Wolf
Received on Fri Oct 15 1999 - 14:44:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US