|
本帖最后由 jiawang 于 2020-3-16 14:58 编辑
1、查看当前审计数据大小:
select segment_name, bytes/1024/1024/1024 as SIZE_GB from dba_segments where segment_name = 'AUD$';
SEGMENT_NAME SIZE_GB
------------------------------ ----------
AUD$ .000061035
2、查看审计表总行数:
select count(*) from sys.aud$;
COUNT(*)
----------
10
3、创建清理sys.aud$表的存储过程procedure:
SQL> create or replace procedure del_aud
2 as
3 begin
4 delete from sys.aud$ where ntimestamp#<=sysdate-1;
5 commit;
6 end;
7 /
过程已创建。
4、立即清理sys.aud$表的Job:
SQL> variable aud_job number;
SQL> begin
2 dbms_job.submit(:aud_job,'del_aud;',sysdate,'sysdate+90');
3 commit;
4 end;
5 /
PL/SQL 过程已成功完成。
SQL> select count(*) from sys.aud$;
COUNT(*)
----------
0
|
|