nathan
nathan

Reputation: 29

how to check last connected user,time in oracle?

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

Answers (2)

Georgy
Georgy

Reputation: 458

Try this:

select username, machine, to_char(logon_time,'HH:MM:SS')
from v$session 
where username='SYS'  <-- username

Upvotes: 0

thatjeffsmith
thatjeffsmith

Reputation: 22457

Enable auditing.

Then audit connects - very easy command

audit connect

Docs Link Here

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

enter image description here

Upvotes: 4

Related Questions