Last logon for an Oracle user

hi,
I need to pull out a report for the all users in the database  with their last logoff time.
I already tried dba_audit_session....
There are some users who login and log out serveral times, I need only their last log off info...
Need help with the query from sys.aud $ table....
Oracle version - 11.2.0.1
thank you
gyans
LVL 1
gyansAsked:
Who is Participating?
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
Assuming you are currently auditing logoffs, another way

select username, max(logoff_time) from dba_audit_trail group by username;


http://docs.oracle.com/cd/E11882_01/server.112/e40402/statviews_3081.htm#REFRN23023
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you want to start with this:
select userid, max(ntimestamp)
from sys.aud$
where action# in (100,101,102)
group by userid
0
 
gyansAuthor Commented:
hi Hengel,
It gives me an error with the timestamp being an invalid identifier.

Slightwv- cannot get the info from this view.
thanks
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
slightwv (䄆 Netminder) Commented:
>>Slightwv- cannot get the info from this view.

Log in as a privileged user.

If that doesn't work, what version of Oracle are you using (all 4 numbers please).
0
 
gyansAuthor Commented:
slightwv - we only store audit for 1 week and move the rest to the archive table.
The archive table is identical to aud$ table, so I can only query from this table.
thanks
0
 
slightwv (䄆 Netminder) Commented:
>>so I can only query from this table. thanks

Then you don't really want the LAST logoff?  Just the last logoff you can see?

I'm not an Expert on auditing but the archive table you have should have similar columns to what Guy posted above.

Just describe the table and then check the online docs for your version and see what columns and audit actions are what you need.
0
 
gyansAuthor Commented:
i wrote a query to get the last log off from the archive table .
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.