Tag Archives: DBMS_FGA.ADD_POLICY

Create and drop Fine Grained Auditing policy in Oracle

Fine Grained Auditing enable trace in Oracle

Fine Grained auditing is used to trace the table object with insert, update & delete operation. Without enable the System parameter AUDIT_TRAIL.
Fine grained auditing records are stored in SYS.FGA_LOG$ table and are accessible through the DBA_FGA_AUDIT_TRAIL view.

Note: DBA_COMMON_AUDIT_TRAIL view combines standard and fine-grained audit log records.

Fine Grained policy defined on the data access conditions from the objects in database.
Example you want to audit record if some one fetch the records of employee having salary greater than 5 lacs. In this you can add policy on employee table with column salary and condition > 5 lacs.

Create or add the Fine Grained Policy for Audit

In example, we monitor salary column of the hr.emp table of all insert, update, delete or select statements for department sales.

Note: If you execute the SQL statement which uses salary column and in where condition dept = sales then it will generate audit.
Following are example of generate audit:

Check the Audit record after fine grain auditing policy

select * from DBA_FGA_AUDIT_TRAIL;

select * from SYS.FGA_LOG$;

Example for DBMS_FGA.ADD_POLICY with all parameters

Enable the Fine Grained Auditing policy

Disable the Fine grained Policy in Oracle

DBMS_FGA.DISABLE_POLICY(
object_schema VARCHAR2,
object_name VARCHAR2,
policy_name VARCHAR2 );

Drop the fine grained policy in Oracle