Oracle Basic Auditing

Tags: Oracle, audit, auditing, sessions

select
to_number(substr(dbms_session.unique_session_id,1,4),'XXXX') as mysid, 
sys_context('USERENV','SID') as my_current_session,
sys_context('USERENV','SESSIONID') as my_audsid,
sysdate as now,
case when timestamp <= to_timestamp('07-JUN-2018 15:49:27','DD-MON-YYYY HH24:MI:SS') then 'TONY' else 'SOMEONE ELSE' end as whoami,
at.*
from dba_audit_trail at, V$SESSION SESS -- but v$session only shows current session
where timestamp > sysdate - 2
and userhost = '<my_machine_name>'
AND at.SESSIONID = SESS.AUDSID (+)
order by timestamp desc

/*

--SELECT * FROM dba_hist_sysmetric_summary

--SELECT * FROM v$active_session_history

*/

No Comments

You must log on to comment.