I want to audit a specific SQL query in Oracle. However I think we can audit only users or table level.

For example I want to audit 'audit statements', such as who run the "AUDIT CREATE SESSION by username by access" query.

Thanks for supports.

  • What version of Oracle are you using? Audit statements can be audited.
    – pmdba
    Mar 4 '21 at 21:10
  • Oracle 12c Enterprise Edition. How can I audit the audit statements? Mar 4 '21 at 21:33

You are right in that audits of "audit" statements need to be made at the object level.

Using Traditional Auditing, you can use a query to generate a script to enable audit tracking for existing objects:

select 'audit audit on '||owner||'.'||object_name;' from dba_objects where owner='[owner]';

After that, or ideally when you first configure your database and before you install any schemas, you can set auditing of audit to happen by default for all future created objects with:

audit audit by default;

With Unified Auditing you can do something like this:

create audit policy audit_actions actions audit table, audit view, audit procedure, audit package, audit directory;
audit policy audit_actions;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.