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: Is it possible to get name of datebase in SQLPLUS?

Re: Is it possible to get name of datebase in SQLPLUS?

From: Mark D Powell <mark.powell_at_eds.com>
Date: 28 May 2002 06:46:13 -0700
Message-ID: <178d2795.0205280546.20f7b4a5@posting.google.com>


"zibi" <gumisiaczek_at_wp.pl> wrote in message news:<acvill$1n4n$1_at_news2.ipartners.pl>...

> Is it possible to get name of datebase in SQLPLUS?
> How can I do it?
> 
> Can You help me?

Aibi, see the SQL Manual chapter on Oracle provided single row functions and look up sys_context. It can provide all kinds of information including the database name, Oracle user name, Os username, IP address etc.....

select

       rpad('bg_job_id ',30,'
')||sys_context('USERENV','bg_job_id')

,rpad('current_user ',30,'

')||sys_context('USERENV','CURRENT_USER')

,rpad('db_domain ',30,'

')||sys_context('USERENV','DB_DOMAIN')

,rpad('db_name ',30,'

')||sys_context('USERENV','DB_NAME')

,rpad('host ',30,' ')||sys_context('USERENV','host')
,rpad('ip_address ',30,'

')||sys_context('USERENV','ip_address')

,rpad('authentication_type',30,' ')||

            sys_context('USERENV','AUTHENTICATION_TYPE')

,rpad('isdba ',30,' ')||sys_context('USERENV','isdba')
,rpad('os_user ',30,'
')||sys_context('USERENV','os_user')
,rpad('proxy_userid ',30,'
')||sys_context('USERENV','proxy_userid')
,rpad('session_user ',30,'

')||sys_context('USERENV','session_user') from sys.dual
/

HTH -- Mark D Powell -- Received on Tue May 28 2002 - 08:46:13 CDT

Original text of this message

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