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: instance_name as unprivileged user

Re: instance_name as unprivileged user

From: DA Morgan <damorgan_at_psoug.org>
Date: Wed, 21 Dec 2005 13:05:38 -0800
Message-ID: <1135199123.204018@jetspin.drizzle.com>


yong321_at_yahoo.com wrote:
> DA Morgan wrote:
>

>>Just being picky here but Oracle has deprecated USERENV and recommends
>>using, instead, SYS_CONTEXT. The query would be either:
>>
>>SELECT sys_context('USERENV', 'INSTANCE') FROM dual;
>>or
>>SELECT sys_context('USERENV', 'INSTANCE_NAME') FROM dual;
>>--
>>Daniel A. Morgan
>>http://www.psoug.org
>>damorgan_at_x.washington.edu
>>(replace x with u to respond)

>
>
> Just to make sure OP understands. Before Oracle 10gR2, I don't think
> you can get instance name (as the value under instance_name of
> v$instance) unless you're granted select on v_$instance (or
> select_catalog_role or other similar privs/roles). For a non-RAC
> database, instance name probably happens to be the same as database
> name. If so, sys_context('USERENV', 'DB_NAME') serves the purpose.
> sys_context('USERENV', 'INSTANCE') gives the instance number only.
> 'USERENV' namespace doesn't have 'INSTANCE_NAME' parameter until 10gR2.
>
> Yong Huang

Correct. But except in a RAC environment ... instance will always be 1 and there is no need to care beyond that. But your point is well made.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Wed Dec 21 2005 - 15:05:38 CST

Original text of this message

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