Reputation: 29
please let me know How to Find When the User Last Logged into the Database? please let me know how to check this information with the command.
Upvotes: 1
Views: 20054
Reputation: 458
Try this:
select username, machine, to_char(logon_time,'HH:MM:SS')
from v$session
where username='SYS' <-- username
Upvotes: 0
Reputation: 22457
Enable auditing.
Then audit connects - very easy command
audit connect
Then do some connects.
Then query sys.dba_audit_session -
SELECT
username,
timestamp
FROM
sys.dba_audit_session
WHERE
username = 'HR' -- the user you care about
AND action_name = 'LOGON'
ORDER BY
timestamp DESC
FETCH FIRST 1 ROWS ONLY -- in 11g or older just also say where rownum < 2
Upvotes: 4