Oracle FGA细粒度审计

如果你想要审计表上,在某个时间,哪些人,操作哪些DML语句,用FGA是个不错的选择。

SQL> select * from v$version;

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

PL/SQL Release 11.2.0.1.0 - Production

CORE    11.2.0.1.0      Production

TNS for Linux: Version 11.2.0.1.0 - Production

NLSRTL Version 11.2.0.1.0 - Production

SQL>drop table test purge;

SQL>create table test as select * from dba_objects;

SQL> exec DBMS_FGA.ADD_POLICY(object_schema=>‘LCAM_TEST‘,object_name=>‘test‘,policy_name=>‘FGA_1‘,enable=>TRUE,statement_types=>‘UPDATE,delete‘,audit_trail=>DBMS_FGA.DB+DBMS_FGA.EXTENDED,audit_column_opts=>DBMS_FGA.ANY_COLUMNS);--statement_types可以设置select,insert,delete,update

SQL> col SQL_TEXT format a80

SQL> select SQL_TEXT,TIMESTAMP from DBA_FGA_AUDIT_TRAIL order by TIMESTAMP;

SQL> update test set subobject_name=object_id where rownum=1;

SQL> select SQL_TEXT,TIMESTAMP from DBA_FGA_AUDIT_TRAIL order by TIMESTAMP;

update test set subobject_name=object_id where rownum=1                         01-12月-14

SQL> update test set subobject_name=object_id where rownum<100;--可以看到是按照SQL语句来审计的,不是按照行变动审计

SQL> select SQL_TEXT,TIMESTAMP from DBA_FGA_AUDIT_TRAIL order by TIMESTAMP;

update test set subobject_name=object_id where rownum<100                       01-12月-14

update test set subobject_name=object_id where rownum=1                         01-12月-14

SQL> delete from  sys.fga_log$;

SQL> commit;

SQL> select SQL_TEXT,TIMESTAMP from DBA_FGA_AUDIT_TRAIL order by TIMESTAMP;

SQL>

还有让审计失效、激活、删除的方法:

exec DBMS_FGA.DISABLE_POLICY (object_schema=>‘LCAM_TEST‘,object_name=>‘test‘,policy_name=>‘FGA_1‘);

exec DBMS_FGA.ENABLE_POLICY (object_schema=>‘LCAM_TEST‘,object_name=>‘test‘,policy_name=>‘FGA_1‘);

exec DBMS_FGA.DROP_POLICY(object_schema=>‘LCAM_TEST‘,object_name=>‘test‘,policy_name=>‘FGA_1‘);

官方文档的位置是:

Oracle? Database PL/SQL Packages and Types Reference  11g Release 2 (11.2)   DBMS_FGA

Table 66-2 ADD_POLICY Procedure Parameters

Parameter Description Default Value

object_schema


The schema of the object to be audited. (If NULL, the current log-on user schema is assumed.)


NULL


object_name


The name of the object to be audited.


-


policy_name


The unique name of the policy.


-


audit_condition


A condition in a row that indicates a monitoring condition. NULL is allowed and acts as TRUE.


NULL


audit_column


The columns to be checked for access. These can include OLS hidden columns or object type columns. The default, NULL, causes audit if any column is accessed or affected.


NULL


handler_schema


The schema that contains the event handler. The default, NULL, causes the current schema to be used.


NULL


handler_module


The function name of the event handler; includes the package name if necessary. This function is invoked only after the first row that matches the audit condition in the query is processed. If the
procedure fails with an exception, the user SQL statement will fail as well.


NULL


enable


Enables the policy if TRUE, which is the default.


TRUE


statement_types


The SQL statement types to which this policy is applicable: INSERTUPDATE,DELETE, or SELECT only.


SELECT


audit_trail


Destination (DB or XML) of fine grained audit records. Also specifies whether to populate LSQLTEXT and LSQLBIND in fga_log$.


DB+EXTENDED


audit_column_opts


Establishes whether a statement is audited when the query referencesany column specified in the audit_column parameter or only when allsuch
columns are referenced.


ANY_COLUMNS

时间: 2024-11-07 18:09:07

Oracle FGA细粒度审计的相关文章

Oracle fga审计有这几个特性

fga审计有这几个特性: 本文为原创文章,转载请注明出处: http://blog.csdn.net/msdnchina/article/details/38409057 1.select * from table_xxx where 1=2 --该语句是不会被审计到dba_fga_audit_trail中的,原因我猜测是没有任何记录被select到 2.以sys用户登陆 一个会话,执行select * from user.table_xxx ,是不会被fga审计到的(也就是不往dba_fga_

Oracle FGA审计记录的清理步骤

注意:本文为原创文章,转载请注明出处: http://blog.csdn.net/msdnchina/article/details/38435999 一.确认有哪些fga审计策略, 从select * from dba_audit_policies就可以查询到审计策略,请注意,查询结果中的每一行,就是一个审计策略. 另外,fga审计记录存放在这个视图中:select * from dba_fga_audit_trail 该视图对应的后台基表为:sys.fga_log$,见如下的视图.注意,fg

使用DBMS_FGA实现细粒度审计

实验:使用DBMS_FGA实现细粒度审计 1,创建测试表 [email protected]> create table audit_test (x number ); Table created. 2,创建审计策略 [email protected]> conn / as sysdba Connected. [email protected]> begin DBMS_FGA.ADD_POLICY ( object_schema      =>  'TEST_USR1', --要审

oracle 细粒度审计使用

以scott用户的emp表为示例 ----增加策略 begin DBMS_FGA.ADD_POLICY ( object_schema      =>  'SCOTT', object_name        =>  'EMP', policy_name        =>  'mypolicy1', handler_schema     =>   NULL, handler_module     =>   NULL, enable             =>   T

Oracle未开启审计情况下追踪表变更记录

运维组的老大打电话说,他们发现有几万笔业务被重新推送了一遍,而且是第三次了,问题还是挺严重的,想要追踪是谁做的误操作,他们有时间段和涉及的表,问有没有办法追踪到. 数据库版本为10.2.0.4.首先想到的是审计功能,但是无奈数据库没有开审计.再次想到的是日志挖掘(LogMiner),但是不确定能不能找到对应操作的用户和主机.在QQ群里提出了这个问题,得到的答案是可以找到,同时也在官方文档中找到了v$logmnr_contents中对就的SESSION_INFO字段: 从上面给出的信息可以看出,可

Oracle数据库SQL审计

在我们日常的工作中,一些安全性的要求高的数据库需要增加审计操作,哪个用户什么时间做了什么操作. 1.打开数据库的审计 alter system set audit_sys_operations=TRUE scope=spfile; //审计管理用户 alter system set audit_trail=db,extended scope=spfile; //将sql语句写入审计表中 2.对数据库重启并查看 重启数据库 shutdown immediate; startup; show par

oracle如何启用审计

通过数据库初始化参数文件中的AUDIT_TRAIL 初始化参数启用和禁用数据库审计. DB  启用数据库审计并引导所有审计记录到数据库的审计跟踪 OS  启用数据库审计并引导所有审计记录到操作系统的审计跟踪.可以用AUDIT_FILE_DEST初始化参数来指        定审计文件存储的目录. NONE 禁用审计这个值是默认值 原文地址:https://www.cnblogs.com/fanweisheng/p/11113512.html

oracle如何看审计的结果

1)数据库初始化参数文件中AUDIT_TRAIL=OS时,审计记录存在操作系统的文件中. UNIX系统的话,默认存在“$oracle_home/rdbms/audit/” 目录下. If you have set AUDIT_TRAIL = OS, modify the "init.ora" file to specify the destination for the audited records using the AUDIT_FILE_DEST parameter. If yo

oracle有哪些审计项

ACTION NAME 0 UNKNOWN 1 CREATE TABLE 2 INSERT 3 SELECT 4 CREATE CLUSTER 5 ALTER CLUSTER 6 UPDATE 7 DELETE 8 DROP CLUSTER 9 CREATE INDEX 10 DROP INDEX 11 ALTER INDEX 12 DROP TABLE 13 CREATE SEQUENCE 14 ALTER SEQUENCE 15 ALTER TABLE 16 DROP SEQUENCE 17