Re: Using SQL*Plus in Batch Environment
Date: 1998/02/16
Message-ID: <6c8fpt$iq2_at_bgtnsc03.worldnet.att.net>#1/1
Randy,
[Quoted] Try starting your SQL*Plus script file these commands:
WHENEVER SQLERROR EXIT 1 CONNECT USERID/PASSWORD ... ...the rest of your script
Then execute this file from the OS prompt using the /NOLOG option:
sqlplus /nolog _at_yourfile
If the password is incorrect the script will error out and control will return to your OS batch file. I assume that the error code of 1 would be passed back as well, but I havn't tested that.
Let me know if this works.
Jonathan
On Fri, 13 Feb 1998 11:50:20 -0600, Randy Lewis <rlewis_at_systemhouse.mci.com> wrote:
>Question to the Knowledgible,
>
>I am attempting to use SQL*Plus in an un-attended batch environment. We
>are using Korn shell under Solaris. I want the ability to detect an
>unsuccessful attempt at logging into the Oracle database using
>SQL*Plus. I have tried testing the return code in the shell, but all I
>get is zero. Only if I fail the login attempt three times does SQL*Plus
>return a non-zero return code; but in an un-attended batch environment
>it will only attempt one login and then abort.
>
>Shell Script:
>
> if sqlplus userid/password _at_$SQL_DIR/sql.sql 2>&1 1>logfile
> then
> :
> else
> echo ERROR occured during SQLPlus run...
> exit 1
> fi
>
>
>The above code produces a return code of zero if the userid or the
>password is invalid. Any help would be appreciated.
>
>Randy
>
Received on Mon Feb 16 1998 - 00:00:00 CET
