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

Home -> Community -> Usenet -> c.d.o.server -> Re: Using "whenever oserror" on Windows

Re: Using "whenever oserror" on Windows

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 2 Apr 2005 16:39:35 -0800
Message-ID: <1112488775.254606.210110@f14g2000cwb.googlegroups.com>

Vsevolod Afanassiev wrote:
> When writing SQL scripts for batch execution on UNIX I normally put
> "whenever sqlerror", "whenever oserror" at the top, for example
>
> ---------------------------------------
> whenever sqlerror exit failure rollback
> whenever oserror exit failure rollback
>
> connect user/pass
>
> <do something>
>
> exit
> -----------------------------------------
> and then check for return code from SQL*Plus.
>
> For some reason it does not work on Windows - the "whenever oserror"
> bit leads to message
> O/S Message: No such file or directory
>
> For example:
> ---------------------------------------
> whenever sqlerror exit failure rollback
> whenever oserror exit failure rollback
>
> connect / as sysdba
> select * from dual;
>
> exit
> -----------------------------------------
>
> This is for Oracle 9.2.0.4.0 on Windows 2003.
>
> File "glogin.sql" is where it should be, i.e. in
> ORACLE_HOME\sqlplus\admin.
>
> It is not that I particularly need this "oserror" thing to work, but
it
> would be nice to know what is wrong with it.
>
> Thanks

It does that on XP also. I thought it was looking for login.sql. Created a login.sql and tried placing that under SQLPATH value, system path, current directory, user home directory etc etc without any luck.

I believe the only workarounds are,

  1. Move the connect statement out of the file and to the command line, sqlplus "/ as sysdba" @script.sql OR
  2. Change the connect clause to do a remote connection instead of local, connect sys/password_at_database as sysdba

Regards
/Rauf Received on Sat Apr 02 2005 - 18:39:35 CST

Original text of this message

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