Oracle XE 11g R2 – activate audit / log queries

To log queries on oracle, proceed as follow:

  1. login as system (`sqlplus system`)
  2. check audit status
    show parameter AUDIT_TRAIL; // if NONE => no audit activated
  3. activate audit
    ALTER SYSTEM SET AUDIT_TRAIL=DB SCOPE=SPFILE;
  4. restart db for parameter to take effect
    /etc/init.d/oracle-xe restart
  5. from this point forward, activate audit on specific tables and/or actions and/or users using the AUDIT XXX statement, as `system`, run:
    AUDIT SELECT on userlambda.tablename // audit/log all SELECT queries on all tables db for user userlambda

All audit entries are stored under sys.AUD$ table (login as system to access it).

Note: to deactivate audit, run

ALTER SYSTEM SET AUDIT_TRAIL=none SCOPE=SPFILE;

Then restart oracle as mentioned above.

sources

Post a Comment

Your email is never published nor shared. You're allow to say what you want...