首页 > 数据库 > Oracle > AUDIT_TRAIL设置及审计日志清理
Oracle公司还推荐使用基于OS文件的审计日志记录方式(OS audit trail files)。
在日常的数据库维护中,经常出现因为数据库登录审计的功能启动,导致system表空间被用满.从而出现异常,一般建议把aud$相关对象迁移到其他表空间,从而避免system被用完的风险.
10g及以前迁移方法
alter table AUDIT$ move tablespace users;
alter table AUDIT_ACTIONS move tablespace users;
alter table AUD$ move tablespace users;
alter table AUD$ move lob(SQLBIND) store as SYS_IL0000000384C00041$$ (tablespace users);
alter table AUD$ move lob(SQLTEXT) store as SYS_IL0000000384C00041$$ (tablespace users);
alter index I_AUDIT rebuild online tablespace users;
alter index I_AUDIT_ACTIONS rebuild online tablespace users;
11g以后
可以使用DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION进行迁移
conn / as sysdba
BEGIN
DBMS_AUDIT_MGMT.SET_AUDIT_TRAIL_LOCATION(audit_trail_type => DBMS_AUDIT_MGMT.AUDIT_TRAIL_DB_STD,
audit_trail_location_value => 'USERS');
END;
/
10g及以前通过手工清理的方式或自定义作业来定期清理
DELETE FROM SYS.AUD$;
DELETE FROM SYS.AUD$
WHERE obj$name='EMP';
OS和XML选项下进行手动删除审计文件
11g 新特性
通过DBMS_AUDIT_MGMT包下的子过程进行手动或定期清理,功能如下
|
Subprogram |
Description |
|
Deletes audit trail records/files that have been archived |
|
|
Clears the timestamp set by the SET_LAST_ARCHIVE_TIMESTAMP Procedure |
|
|
Creates a purge job for periodically deleting the audit trail records/files |
|
|
Undoes the setup and initialization performed by the INIT_CLEANUP Procedure |
|
|
Drops the purge job created using the CREATE_PURGE_JOB Procedure |
|
|
Sets up the audit management infrastructure and sets a default cleanup interval for audit trail records/files |
|
|
Checks to see if the INIT_CLEANUP Procedure has been run for an audit trail type |
|
|
Sets a timestamp indicating when the audit records/files were last archived |
|
|
Sets the interval at which the CLEAN_AUDIT_TRAIL Procedure is called for the purge job that you specify |
|
|
Enables or disables the purge job that you specify |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29537723/viewspace-1816332/ ,如需转载,请注明出处,否则将追究法律责任。