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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: get host name in sqlplus

Re: get host name in sqlplus

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Tue, 20 May 2003 14:11:51 -0800
Message-ID: <F001.0059E605.20030520141151@fatcity.com>


> "Leyden, Joseph" wrote:
>
> How do I get the hostname while in SQLPLUS?
> Is there a sql command to do that?
>
> TIA
Depends on which host you want.
Server :

    select machine
    from v$session
    where sid = 1;

Client (current) :

    select machine
    from v$session
    where audsid = sys_context('USERENV', 'SESSIONID');

Since V$SESSION is not accessible to anybody, you may wish to create views (as SYS) on it and grant SELECT on these views to PUBLIC.

-- 
Regards,

Stephane Faroult
Oriole Software
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Stephane Faroult
  INET: sfaroult_at_oriole.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue May 20 2003 - 17:11:51 CDT

Original text of this message

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