using varray
set serveroutput ON
DECLARE
type aud_int_type IS varray(10) of integer;
type aud_str_type IS varray(10) of varchar2(60);
audits aud_int_type;
audit_names aud_str_type;
total integer;
begin
audits := aud_int_type(SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD,
SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD,
SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_FILES,
SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS,
SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD,
SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML);
audit_names := aud_str_type('SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD',
'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD',
'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_FILES',
'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS',
'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD',
'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML');
total := audits.count;
for i in 1 .. total LOOP
if DBMS_AUDIT_MGMT.IS_CLEANUP_INITIALIZED(audit_trail_type => audits(i)) then
dbms_output.put_line(audits(i) || ' initialized');
else
dbms_output.put_line(audits(i) || ' not initialized');
end if;
end LOOP;
total := audit_names.count;
for i in 1 .. total LOOP
dbms_output.put_line('exec DBMS_AUDIT_MGMT.DEINIT_CLEANUP(audit_trail_type => ' || (audit_names(i) || ');');
end LOOP;
end;
/
using record
set serveroutput ON
DECLARE
type aud_type IS record (value integer, name varchar2(60));
type aud_tab IS table of aud_type INDEX by binary_integer;
audits aud_tab;
total integer;
begin
audits(1).value := SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD;
audits(2).value := SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD;
audits(3).value := SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_FILES;
audits(4).value := SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS;
audits(5).value := SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD;
audits(6).value := SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML;
audits(1).name := 'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_AUD_STD';
audits(2).name := 'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_FGA_STD';
audits(3).name := 'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_FILES';
audits(4).name := 'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_OS';
audits(5).name := 'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD';
audits(6).name := 'SYS.DBMS_AUDIT_MGMT.AUDIT_TRAIL_XML';
total := audits.count;
for i in 1 .. total LOOP
if DBMS_AUDIT_MGMT.IS_CLEANUP_INITIALIZED(audit_trail_type => audits(i).value) then
dbms_output.put_line(audits(i).name || ' initialized');
else
dbms_output.put_line(audits(i).name || ' not initialized');
end if;
end LOOP;
for i in 1 .. total LOOP
dbms_output.put_line('exec DBMS_AUDIT_MGMT.DEINIT_CLEANUP(audit_trail_type => ' || audits(i).name || ');');
end LOOP;
end;
/