Use of fine-grained oracle Auditing
Take the scott user's emp table as an Example
---- Add a policy
Begin
DBMS_FGA.ADD_POLICY (
Object_schema => 'Scott ',
Object_name => 'emp ',
Policy_name => 'mydomainy1 ',
Handler_schema => NULL,
Handler_module => NULL,
Enable => TRUE,
Statement_types => 'insert, UPDATE, delete ',
Audit_column_opts => DBMS_FGA.ANY_COLUMNS );
End;
---- Enable policy
Begin
DBMS_FGA.ENABLE_POLICY (
Object_schema => 'Scott ',
Object_name => 'emp ',
Policy_name => 'mydomainy1 ',
Enable => TRUE );
End;
Select * from dba_fga_audit_trail;
Select * from dba_audit_policies;
Select db_user, timestamp, SQL _text, SQL _bind from dba_fga_audit_trail; -- Audit Result
SELECT text FROM dba_Views where view_name = upper ('dba _ FGA_AUDIT_TRAIL '); -- view records
---- Deletion policy
Begin
Dbms_fga.drop_policy (
Object_schema => 'Scott ',
Object_name => 'emp ',
Policy_name => 'mydomainy1'
);
End;