Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows user login?? 3

Status
Not open for further replies.
select sys_context('USERENV','SESSION_USER') from dual;
 
Hi,
Does not work for me..

Code:
Connected to:
Oracle8i Enterprise Edition Release 8.1.5.1.0 - Production
With the Partitioning and Java options
PL/SQL Release 8.1.5.1.0 - Production

SQL> select sys_context('USERENV','SESSION_USER') from dual;

SYS_CONTEXT('USERENV','SESSION_USER')
--------------------------------------------------------------------------------
WAREHOUSE

SQL>


It knows my Oracle login but not my UserName in Windows or the Network

[profile]
 
If you have DBA role:
SELECT
s.username ora_uid,
s.osuser usr,
s.machine machine,
s.program apps
FROM v$sess_io io,
v$process p,
v$session s
WHERE s.paddr = p.addr
AND s.sid = io.sid
AND s.TYPE = 'USER';
 
Try this:

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

This should return OS login name for current user. You may modify where clause to get information about others. Of course, it works only for client/server.

Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top