Home » RDBMS Server » Server Administration » How do I detect the current user id logged in to the OS?
How do I detect the current user id logged in to the OS? [message #51187] Mon, 06 May 2002 10:14 Go to next message
Harish Vaswani
Messages: 4
Registered: May 2002
Junior Member
Hi,

I need to extract the current user logged in to the OS from my trigger. Does oracle store / have access to this information? If so, how do we get it?

Thanks!
Re: How do I detect the current user id logged in to the OS? [message #51192 is a reply to message #51187] Mon, 06 May 2002 12:23 Go to previous messageGo to next message
Sanjay Bajracharya
Messages: 279
Registered: October 2001
Location: Florida
Senior Member
Hmm...

You need to know the user logged in the OS from inside ORACLE ? There could be users logged into the OS but not connected to Oracle at all ? Or did you mean people connected to Oracle ?

check out v$session as follows:

select username, osuser from v$session;
Re: How do I detect the current user id logged in to the OS? [message #51207 is a reply to message #51192] Tue, 07 May 2002 06:32 Go to previous messageGo to next message
Harish Vaswani
Messages: 4
Registered: May 2002
Junior Member
Hi,

What I really need to do is build an audit trigger, which would fire is someone made an insert, update or delete on a table and the trigger would then log the user id (unix id) of the user who made the change.

Is there a way to get this info?

Thanks a ton!
Re: How do I detect the current user id logged in to the OS? [message #51212 is a reply to message #51192] Tue, 07 May 2002 09:27 Go to previous messageGo to next message
Sanjay Bajracharya
Messages: 279
Registered: October 2001
Location: Florida
Senior Member
select sid, serial#, osuser from v$session;

gives most of the information needed.
That works...... [message #51213 is a reply to message #51192] Tue, 07 May 2002 10:40 Go to previous messageGo to next message
Harish Vaswani
Messages: 4
Registered: May 2002
Junior Member
Thanks a ton!
Re: How do I detect the current user id logged in to the OS? [message #51236 is a reply to message #51192] Wed, 08 May 2002 08:27 Go to previous messageGo to next message
Harish Vaswani
Messages: 4
Registered: May 2002
Junior Member
Hey,

Got a question again. The query works fine from SQL Plus but when I use it in my trigger (connected as system), it doesnt compile the trigger and complains of "sys.v_$session needs to be declared". Any thoughts?

Thanks
Re: How do I detect the current user id logged in to the OS? [message #51244 is a reply to message #51236] Wed, 08 May 2002 12:18 Go to previous message
Sanjay Bajracharya
Messages: 279
Registered: October 2001
Location: Florida
Senior Member
I had developed the query for a trigger (just like you) for auditing purposes quiet some time back. I do not recall any problems though. Sorry that's all I can help/share with at the moment.

Later.
Previous Topic: svrmgr
Next Topic: Oracle character set question
Goto Forum:
  


Current Time: Fri Sep 13 01:09:23 CDT 2024