|
在使用数据库的过程中,如果开启了数据库审计,aud$表将使用过多的sysaux表空间,可以考虑定期对审计数据进行清除,避免sysaux表空间使用过多。
(1)查询数据库是否有同名的job
select * from dba_scheduler_jobs where job_name='JOB_DEL_AUD';
(2)创建scheduler job
begin
sys.dbms_scheduler.create_job(job_name => 'SYS.JOB_DEL_AUD',
job_type => 'STORED_PROCEDURE',
job_action => 'DEL_AUD',
start_date => to_date('03-06-2019 16:00:00', 'dd-mm-yyyy hh24:mi:ss'),
repeat_interval => 'FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=1;BYHOUR=1;BYMINUTE=0;BYSECOND=0',
end_date => to_date(null),
job_class => 'DEFAULT_JOB_CLASS',
enabled => true,
auto_drop => false,
comments => '');
end;
/
(3)查询是否有同名触发器
select * from dba_objects where object_name=upper('del_aud');
(4)创建触发器
create or replace procedure del_aud
as
begin
delete from sys.aud$ where ntimestamp#<=sysdate-15;
commit;
end;
/
|
|