18

I'm using Oracle 11g Standard Edition.

I would like to log all SQL queries, that are being executed by users, into a table.

How can this be done?

3
  • For what purpose do you want this information? Is it auditing? Usage monitoring? Something else? Commented Oct 30, 2011 at 4:51
  • It's for auditing (select, update, insert, delete) Commented Nov 2, 2011 at 12:44
  • Related: stackoverflow.com/questions/1570978/oracle-xe-query-log Commented Mar 8, 2013 at 14:09

2 Answers 2

11

If you're using a modern version of the database (9i or later) and you have an Enterprise Edition license you can use Fine-Graining Auditing. It allows us to audit user queries at a very low level of granularity, through defined policies.

To capture SQL text and bind variables you will need to set the AUDIT_TRAIL parameter appropriately when adding an FGA Policy. Find out more.


"i'm using an 11g standard, so auditing functions are not supported."

Not exactly. The AUDIT command is part of the standard Oracle build, but it only allows us to capture when a given user issues a SELECT against a given table. But, yes, to find out exactly what they are selecting requires Enterprise Edition license.

Also there is no ON SELECT trigger, so we cannot roll our own.


"So can i use AUDIT command in the standard edition? ... But then a consultant told me, that i cannot use it without paying enterprise license? "

Speaking as a consultant myself, I do have to say those guys don't always know what they are talking about.

So let's be clear:

  • the AUDIT command is part of Oracle SQL. It is usable with the Standard Edition. In fact since 11g it is enabled by default. It audits general activity. Find out more.
  • Fine Grained Auditing is a PL/SQL package with is only usable if you have the Enterprise Edition. It allows us to audit user activity at a very low level. Find out more.
Sign up to request clarification or add additional context in comments.

2 Comments

i'm using an 11g standard, so auditing functions are not supported. :/
So can i use AUDIT command in the standard edition? I already had it working for 2 tables. But then a consultant told me, that i cannot use it without paying enterprise license?
0

For QUICK, EASY logging of SQL, try my monitoring answer here. Not for long-term logging, but works great just to see what is going on in a small time window. :-)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.