
Today in this article, we will learn how to find last login time of a user in Oracle Database. Let’s go through this in detail :
Table of Contents
Query 1 :
SQL> col username for a12
SQL> col last_login for a22
SQL> alter session set NLS_TIMESTAMP_TZ_FORMAT='DD.MM.YYYY HH24:MI:SS';
Session altered.
SQL> select username,last_login from dba_users where username='JOHN';
Output:

Query 2:
SQL>col name for a15
SQL>alter session set NLS_DATE_FORMAT='DD.MM.YYYY HH24:MI:SS';
SQL> select name,spare6 from user$ where name='JOHN';
NAME SPARE6
--------------- -------------------
JOHN 12.07.2024 21:00:07
Output :

Query 3 :
select username,max(logon_time) from v$session where username like '%JOHN%' group by username order by 2;
Hope this helps!! Also, you can get more information from the below Oracle Doc as well :
How to find Last login time of a user in Oracle Database users (Doc ID 2185763.1)
Other Oracle Related Articles :