Hi Exasol team,
Is there a way to retrieve the last login time or session details for a database user?
I’m looking into ways to identify user accounts that haven’t been actively used for some time. Any guidance or best practices would be appreciated!
1 Like
Hello,
The EXA_DBA_SESSIONS_LAST_DAY
view could be used to get information about user activity over the past 24 hours.
However, to analyze data beyond this timeframe, you need to enable auditing (if it is not already activated). You can find out more about auditing and how to switch it on in the article below.
With auditing enabled, you can use EXA_DBA_AUDIT_SESSIONS
to track all user activities, including the last session and last login timestamp. For example, the following query will display the last session for each DB user:
-- Select last user session from audit
select * from
(select a.*,
row_number() over (partition by user_name order by login_time desc) as rn
from EXA_DBA_AUDIT_SESSIONS a
)
where rn =1
order by user_name;
1 Like