Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: different DB state via same SQL cmd
dompie wrote:
> Helo ,
>
> I noticed something very strange with the result of an SQL query.
>
> I have a script for a third party apps the back up the apps and the
> Oracle db that uses it.
> The script didn't work. After investigation, I noticed that within the
> script there is a function that checks if the database is up and
> running. The check is done via an sql statement. Basically, a
> connection via sqlplus is made using sysdba and the following
> statement is issued:
> "select state from v$instance;"
>
> If the output from this sql cmd returns "OPEN" then the database is
> considered up and running and the script continues. In my case, the
> script stop here.
> I did the following test:
> An 'su' from root to Oracle using 'su - oracle' and then the SQL
> returns the 'OPEN' state.
> An 'su' from root to Oracle using 'su oracle' and then the SQL returns
> an 'STARTED' state.
>
> So, the same sql cmd, executed by Oracle, returns a different output
> depending on the 'su'
> (note that the script does a 'su oracle' and not an 'su - oracle')
> The only reason I see is a difference in env settings.
> I still need to investigate why the two SQL results are different but
> I understand why it doesn't work.
>
> There is only on DB on the system using Oracle v9.
>
> Can this be explained? I cannot alter the db script since then I have
> no more vendor support but in any case, Oracle should return the same
> result (not?)
>
> Any help much appreciated.
>
> With kind regards,
>
> Kris
Because a 'sqlplus system/manager' needs the environment variable
oracle_sid to know where to connect to.
Just do a su - oracle next time...
-- Regards, Frank van BortelReceived on Thu Feb 10 2005 - 03:18:29 CST
![]() |
![]() |