Fine Grained Audit: How to capture the value of column, triggering the FGA audit condition
We are using Oracle DB Enterprise Edition 11.2.0.3 on Linux.
We have configured Fine Grained Auditing.
An example of our initial implementation is:
DBMS_FGA.add_policy(
object_schema => 'MYAPP'
, object_name => 'APPLICATION_HEADER'
, policy_name => 'ORG_BOUNDARY_CHK'
, enable => true
, audit_condition => 'SYS.MYAPP_FGA_CHK_ORG_CTX( ORG_NO ) = 1'
, audit_column => null
, statement_types => 'SELECT'
, audit_trail => DBMS_FGA.DB + DBMS_FGA.EXTENDED
);
We created a function (compiled natively) to implement the checks on which the action must be audited.
This created the problem that when a SELECT was run on a table where the condition was never met (no audit triggered) this was much slower. If an audit is triggered the query performs very fast.