-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsdua_stostm.sql
93 lines (93 loc) · 3.04 KB
/
sdua_stostm.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
--------------------------------------------------------------------------------
-- OraDBA - Oracle Database Infrastructure and Security, 5630 Muri, Switzerland
--------------------------------------------------------------------------------
-- Name......: sdua_stostm.sql
-- Author....: Stefan Oehrli (oes) [email protected]
-- Editor....: Stefan Oehrli
-- Date......: 2023.07.06
-- Revision..:
-- Purpose...: Generate Unified Audit trail storage usage modification statements
-- 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 200 HEADING ON VERIFY OFF
SET FEEDBACK OFF SQLCASE UPPER NEWPAGE 1
SET SQLCASE mixed
COLUMN code format a80 wrap heading "Code"
SELECT
code
FROM
(
SELECT
1 AS id,
'-- Alter unified audit trail partition interval ('
|| con_id_to_dbid(sys_context('USERENV', 'CON_ID'))
|| ')' || CHR(10) AS code
FROM
dual
UNION
SELECT
2 AS id,
'BEGIN'
|| CHR(10)
|| ' dbms_audit_mgmt.alter_partition_interval('
|| CHR(10)
|| ' interval_number => 1,'
|| CHR(10)
|| ' interval_frequency => ''DAY'');'
|| CHR(10)
|| 'END;'
|| CHR(10)
|| '/'
|| CHR(10)
|| CHR(10) AS code
FROM
dual
UNION
SELECT
3 AS id,
'-- Alter unified audit trail tablespace' || CHR(10) AS code
FROM
dual
UNION
SELECT
4 AS id,
'BEGIN'
|| CHR(10)
|| ' dbms_audit_mgmt.set_audit_trail_location('
|| CHR(10)
|| ' audit_trail_type => dbms_audit_mgmt.audit_trail_unified,'
|| CHR(10)
|| ' audit_trail_location_value => ''AUDIT_DATA'');'
|| CHR(10)
|| 'END;'
|| CHR(10)
|| '/'
|| CHR(10)
|| CHR(10) AS code
FROM
dual
UNION
SELECT
5 AS id,
'-- Load spillover OS audit files in a unified audit trail' || CHR(10) AS code
FROM
dual
UNION
SELECT
6 AS id,
'BEGIN'
|| CHR(10)
|| ' dbms_audit_mgmt.load_unified_audit_files();'
|| CHR(10)
|| 'END;'
|| CHR(10)
|| '/'
|| CHR(10)
|| CHR(10) AS code
FROM
dual
);
-- EOF -------------------------------------------------------------------------