Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have Oracle 11g in production. Application system is still under active development. It will be very handy to get SQL statements which cause any error.

Does Oracle provide a standard function to trace and log these statements and additional (debug) info?

share|improve this question

While I'm not sure if it's the easiest way, you can use an "after servererror on database" trigger to log all errors to a table.


See also

The documentation for system event triggers is here:

share|improve this answer
there area no SQL statment info. just error message and who ( v$session ) cause it. – evg345 Apr 18 '13 at 8:11
i found DBMS_TRACE package to trace all sql statments and suppose to combine it with "after servererror on database" trigger – evg345 Apr 18 '13 at 8:22
The PSOUG link has an example of how to capture the SQL statement the session was executing when the error occurred. DBMS_TRACE will only trace PL/SQL code so if you have a Java or .Net app for example then this won't help you. – Colin 't Hart Apr 18 '13 at 8:28
to (Colin 't Hart). there are "Tracing SQL" section. – evg345 Apr 18 '13 at 9:31
I understand that this will only trace SQL calls made from PL/SQL but please let me know if this is not the case. – Colin 't Hart Apr 18 '13 at 9:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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