Auditing sessions
When the audit is performed, it is important to be able to identify the originating host, username, and logon and logoff time for sessions. In this recipe we will enable an audit on sessions created by users HR
, DRAPHEAL
, and SMAVRIS
.
Getting ready
All steps from this recipe will be performed on the HACKDB
database.
How to do it...
Connect as user
SYSTEM
, and start to audit sessions for userHR
,DRAPHEAL
, andSMAVRIS
as follows:SQL> conn system Enter password: Connected. SQL> audit session by HR, DRAPHEAL, SMAVRIS; Audit succeeded. SQL>
Next connect as user
HR
and wait for 10 seconds, then disconnect.Connect also as user
DRAPHEAL
andSMAVRIS
and wait for 10 seconds or more, then disconnect.One source of information for audit trails related to the session can be found by querying the
DBA_AUDIT_SESSION
dictionary view. Check the generated audit records byOS_USERNAME
,USERNAME
,USERHOST
,TERMINAL
,TIMESTAMP
,ACTION_NAME
, andLOGOFF_TIME
as follows:
How it works...
The...