Let's Join and share our day to day activities, Views, Knowledge, Questions and achievements in Oracle Database (8i / 9i / 10g or 11g)

Aug 9, 2010

Host and IP address Information



SYS_CONTEXT


The SYS_CONTEXT function is able to return the following host and IP address information for the current session:

* TERMINAL - An operating system identifier for the current session. This is often the client machine name.

* HOST - The host name of the client machine.

* IP_ADDRESS - The IP address of the client machine.

* SERVER_HOST - The host name of the server running the database instance.

The following examples show the typical output for each variant.

SQL> SELECT SYS_CONTEXT('USERENV','TERMINAL') FROM dual;

SYS_CONTEXT('USERENV','TERMINAL')
--------------------------------------------------------------------
oraplanet

1 row selected.

SQL> SELECT SYS_CONTEXT('USERENV','HOST') FROM dual;

SYS_CONTEXT('USERENV','HOST')
--------------------------------------------------------------------
oraplanet

1 row selected.

SQL> SELECT SYS_CONTEXT('USERENV','IP_ADDRESS') FROM dual;

SYS_CONTEXT('USERENV','IP_ADDRESS')
--------------------------------------------------------------------
192.168.0.1

1 row selected.

SQL> SELECT SYS_CONTEXT('USERENV','SERVER_HOST') FROM dual;

SYS_CONTEXT('USERENV','SERVER_HOST')
--------------------------------------------------------------------
Ziya

1 row selected.

SQL>

No comments:

Post a Comment