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