Oracle打开审计
0、审计安装
11g默认是开始审计的,有审计记录,所以不需要安装,如果查询发现表不存在,则需要安装。
使用此命令安装即可,安装完成后重启数据库。
SQL> @/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/cataudit.sql;
1、开启审计
SQL> alter system set audit_trail=db,extended scope=spfile;
System altered.
SQL> alter system set audit_sys_operations=true scope=spfile;
System altered.
SQL>
2、查看数据库审计配置信息
SQL> show parameter audit;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest string /u01/app/oracle/admin/ORDB/adump
audit_sys_operations boolean TRUE
audit_syslog_level string
audit_trail string DB
SQL>
2、查看审计日志表大小
SQL> select bytes/1024/1024 MB from dba_segments where segment_name='AUD$';
MB
----------
1.0000
SQL>
3、审计表空间迁移
审计表默认安装在SYSTEM表空间,在生产环境一般都建议迁移到其他表空间里面,步骤如下:
SQL> create tablespace shenji logging datafile '/u01/app/oracle/oradata/ORDB/shenji.dbf' size 200m autoextend off extent management local segment space management auto;
SQL> alter table aud$ move tablespace shenji;
SQL> alter table audit$ move tablespace shenji;
SQL> alter index i_audit rebuild online tablespace shenji;
SQL> alter table audit_actions move tablespace shenji;
SQL> alter index i_audit_actions rebuild online tablespace shenji;
SQL> select table_name,tablespace_name from dba_tables where table_name like '%AUD%';
SQL> select index_name,tablespace_name from dba_indexes where index_name like '%AUDIT%';
11g默认是开始审计的,有审计记录,所以不需要安装,如果查询发现表不存在,则需要安装。
使用此命令安装即可,安装完成后重启数据库。
SQL> @/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/cataudit.sql;
1、开启审计
SQL> alter system set audit_trail=db,extended scope=spfile;
System altered.
SQL> alter system set audit_sys_operations=true scope=spfile;
System altered.
SQL>
2、查看数据库审计配置信息
SQL> show parameter audit;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
audit_file_dest string /u01/app/oracle/admin/ORDB/adump
audit_sys_operations boolean TRUE
audit_syslog_level string
audit_trail string DB
SQL>
2、查看审计日志表大小
SQL> select bytes/1024/1024 MB from dba_segments where segment_name='AUD$';
MB
----------
1.0000
SQL>
3、审计表空间迁移
审计表默认安装在SYSTEM表空间,在生产环境一般都建议迁移到其他表空间里面,步骤如下:
SQL> create tablespace shenji logging datafile '/u01/app/oracle/oradata/ORDB/shenji.dbf' size 200m autoextend off extent management local segment space management auto;
SQL> alter table aud$ move tablespace shenji;
SQL> alter table audit$ move tablespace shenji;
SQL> alter index i_audit rebuild online tablespace shenji;
SQL> alter table audit_actions move tablespace shenji;
SQL> alter index i_audit_actions rebuild online tablespace shenji;
SQL> select table_name,tablespace_name from dba_tables where table_name like '%AUD%';
SQL> select index_name,tablespace_name from dba_indexes where index_name like '%AUDIT%';
本文来自博客园,作者:花之旭,转载请注明原文链接:https://www.cnblogs.com/huazhixu/p/16517619.html