概述
由于Oracle数据库开启和关闭审计需要重启数据库实例,所以DBA需要提前安排停机维护时间窗口,还要注意为与审计相关的表准备充足的表空间。
1、数据库审计启停前的检查
1.1. 检查审计功能是否启动
SQL> show parameter audit;
1.2. 修改审计表,以及索引的表空间
sql>alter table aud$ move tablespace Tablespacename;
sql>alter index I_aud1 rebuild online tablespace Tablespacename;
sql>alter table audit$ move tablespace Tablespacename;
sql>alter index i_audit rebuild online tablespace Tablespacename;
sql>alter table audit_actions move tablespace Tablespacename;
sql>alter index i_audit_actions rebuild online tablespace Tablespacename;
2、数据库审计启停
2.1. 开启审计
SQL> alter system set audit_sys_operations=TRUE scope=spfile;
SQL> alter system set audit_trail=db,extended scope=spfile;
SQL> shutdown immediate;
SQL> startup;
--检查审计功能是否已开启:
SQL> show parameter audit;
2.2 关闭审计
SQL> alter system set audit_trail = none scope=spfile;
SQL> shutdown immediate;
SQL> startup;
--检查审计功能是否已关闭:
SQL> show parameter audit;
3、检查审计
登录数据库,检查审计日志表,是否出现审计记录。
在操作时一定要观察数据库后台日志是否存在报错信息和监控审计日志所在的表空间增长速度。
SQL> select * from (select sessionid,userid,userhost,ntimestamp# from sys.aud$ order by ntimestamp# desc) where rownum=1;