Experience: is what you get soon after you need it.

Experience: is what you get soon after you need it.

Rasul Allah (sal Allahu alaihi wa sallam) said: "Restore the trusts of those who trust you, and deal not falsely with him who deals falsely with you." [Abu Dawud, Tirmidhi]

Search This Blog

Friday, August 14, 2015

Oracle user context details:

How to get the user context details:

Run the below query to get the details:
select sys_context('userenv','&arg_name') from dual;


SQL> select sys_context('userenv','&arg_name') from dual;


Enter value for arg_name: server_host
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','server_host') from dual

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

SQL> /
Enter value for arg_name: ip_address
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','ip_address') from dual

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


SQL> /
Enter value for arg_name: os_user
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','os_user') from dual

SYS_CONTEXT('USERENV','OS_USER')
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
oracle

SQL> /
Enter value for arg_name: IP_ADDRESS
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','IP_ADDRESS') from dual

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


SQL> /
Enter value for arg_name: NETWORK_PROTOCOL
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','NETWORK_PROTOCOL') from dual

SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


SQL> /
Enter value for arg_name: PROXY_USER
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','PROXY_USER') from dual

SYS_CONTEXT('USERENV','PROXY_USER')
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


SQL> /
Enter value for arg_name: AUTHENTICATION_TYPE
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','AUTHENTICATION_TYPE') from dual

SYS_CONTEXT('USERENV','AUTHENTICATION_TYPE')
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DATABASE

SQL> /
Enter value for arg_name: AUTHENTICATION_DATA
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','AUTHENTICATION_DATA') from dual

SYS_CONTEXT('USERENV','AUTHENTICATION_DATA')
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


SQL> /
Enter value for arg_name: CLIENT_IDENTIFIER
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','CLIENT_IDENTIFIER') from dual

SYS_CONTEXT('USERENV','CLIENT_IDENTIFIER')
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

SQL> /
Enter value for arg_name: HOST
old   1: select sys_context('userenv','&arg_name') from dual
new   1: select sys_context('userenv','HOST') from dual

SYS_CONTEXT('USERENV','HOST')
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
collabn1.shaiksameer



More variables can be found here:
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions165.htm

No comments: