-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsaua_teusr.sql
36 lines (35 loc) · 1.41 KB
/
saua_teusr.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--------------------------------------------------------------------------------
-- OraDBA - Oracle Database Infrastructur and Security, 5630 Muri, Switzerland
--------------------------------------------------------------------------------
-- Name......: saua_teusr.sql
-- Author....: Stefan Oehrli (oes) [email protected]
-- Editor....: Stefan Oehrli
-- Date......: 2023.07.06
-- Revision..:
-- Purpose...: Show top unified audit events by dbusername for current DBID
-- Notes.....:
-- Reference.: SYS (or grant manually to a DBA)
-- License...: Apache License Version 2.0, January 2004 as shown
-- at http://www.apache.org/licenses/
--------------------------------------------------------------------------------
SET PAGESIZE 66 HEADING ON VERIFY OFF
SET FEEDBACK OFF SQLCASE UPPER NEWPAGE 1
SET SQLCASE mixed
ALTER SESSION SET nls_date_format='DD.MM.YYYY HH24:MI:SS';
ALTER SESSION SET nls_timestamp_format='DD.MM.YYYY HH24:MI:SS';
COLUMN dbusername FORMAT A60 WRAP HEADING "DB User"
COLUMN events FORMAT 9,999,999,999 heading "Audit Events"
SPOOL saua_teusr.log
SELECT
nvl(dbusername, 'n/a') dbusername,
COUNT(*) events
FROM
unified_audit_trail
WHERE
dbid = con_id_to_dbid(sys_context('USERENV', 'CON_ID'))
GROUP BY
dbusername
ORDER BY
events DESC;
SPOOL OFF
-- EOF -------------------------------------------------------------------------