Solved

Last logon for an Oracle user

Posted on 2014-04-29
7
14,496 Views
Last Modified: 2014-06-05
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
0
Comment
Question by:gyans
  • 3
  • 3
7 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40029690
you want to start with this:
select userid, max(ntimestamp)
from sys.aud$
where action# in (100,101,102)
group by userid
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 40029710
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
 
LVL 1

Author Comment

by:gyans
ID: 40029730
hi Hengel,
It gives me an error with the timestamp being an invalid identifier.

Slightwv- cannot get the info from this view.
thanks
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40029771
>>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
 
LVL 1

Author Comment

by:gyans
ID: 40029780
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
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40029816
>>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
 
LVL 1

Author Closing Comment

by:gyans
ID: 40115929
i wrote a query to get the last log off from the archive table .
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to recover a database from a user managed backup
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now