Home » SQL & PL/SQL » SQL & PL/SQL » Host Name
Host Name [message #291893] Mon, 07 January 2008 02:38 Go to next message
saiphani723
Messages: 36
Registered: July 2006
Location: Hyderabad
Member
Can anybody tell me the how to know the oracle host name and login id from sql query

show user is showing the to which user i am loging

but i want to from the sql query

Re: Host Name [message #291897 is a reply to message #291893] Mon, 07 January 2008 02:48 Go to previous messageGo to next message
Michel Cadot
Messages: 64127
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> select user, username, machine from v$session
  2  where sys_context('USERENV','SID') = sid
  3  /
USER                           USERNAME                       MACHINE
------------------------------ ------------------------------ --------------------
MICHEL                         MICHEL                         XXXXXXXXXXX

1 row selected.


Regards
Michel
Re: Host Name [message #291900 is a reply to message #291897] Mon, 07 January 2008 02:57 Go to previous messageGo to next message
saiphani723
Messages: 36
Registered: July 2006
Location: Hyderabad
Member
thanq michale for your quick response
this query is giving machine i am using but i want to know the server name
Re: Host Name [message #291902 is a reply to message #291897] Mon, 07 January 2008 03:02 Go to previous messageGo to next message
saiphani723
Messages: 36
Registered: July 2006
Location: Hyderabad
Member
is it possible to know the server name using v$instance
Re: Host Name [message #291904 is a reply to message #291900] Mon, 07 January 2008 03:11 Go to previous message
Michel Cadot
Messages: 64127
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> select host_name from v$instance;
HOST_NAME
----------------------------------------------------------------
XXXXXXXXXXX

1 row selected.

SQL> select sys_context('USERENV','SERVER_HOST') from dual;
SYS_CONTEXT('USERENV','SERVER_HOST')
----------------------------------------------------------------
xxxxxxxxxxx

1 row selected.

Regards
Michel
Previous Topic: Analyze Table
Next Topic: HOW TO USE RECORD STRUCTURE IN A PROCEDURE
Goto Forum:
  


Current Time: Wed Dec 07 06:44:56 CST 2016

Total time taken to generate the page: 0.06333 seconds