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: <akkha_at_my-deja.com>
Date: Sun, 17 Oct 1999 16:35:58 GMT
Message-ID: <7uctte$34n$1@nnrp1.deja.com>


Either way would work. The way to veriy is to do it yourself on the command line. THe '<' is the pipe in thing, pushing data to the previous commands.

In article <38078401.5DD52490_at_alloymail.com>,   GreyWolf_69 <GreyWolf_69_at_alloymail.com> wrote:
> 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
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sun Oct 17 1999 - 11:35:58 CDT

Original text of this message

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