-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsaua_teobjusr.sql
45 lines (44 loc) · 1.68 KB
/
saua_teobjusr.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
37
38
39
40
41
42
43
44
45
--------------------------------------------------------------------------------
-- OraDBA - Oracle Database Infrastructur and Security, 5630 Muri, Switzerland
--------------------------------------------------------------------------------
-- Name......: saua_teobjusr.sql
-- Author....: Stefan Oehrli (oes) [email protected]
-- Editor....: Stefan Oehrli
-- Date......: 2023.07.06
-- Revision..:
-- Purpose...: Show top unified audit events by Object Name without Oracle
-- maintained schemas 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 object_name FORMAT A60 WRAP HEADING "Objects"
COLUMN events FORMAT 9,999,999,999 heading "Audit Events"
SPOOL saua_teobjusr.log
SELECT
nvl(object_name, 'n/a') object_name,
COUNT(*) events
FROM
unified_audit_trail
WHERE
dbid = con_id_to_dbid(sys_context('USERENV', 'CON_ID')) AND
object_schema NOT IN (
SELECT
username
FROM
dba_users
WHERE
oracle_maintained = 'Y'
)
GROUP BY
object_name
ORDER BY
events DESC;
SPOOL OFF
-- EOF -------------------------------------------------------------------------