0

I need to track the value of bind variables to a query that returns an Oracle error.

Since the queries that return errors are not drawn in v$sql_bind_capture and v$sqlarea, I can't look at these tables.

Then I created a trigger after Servererror and logged the query in a trace table created by me. Unfortunately the bind variables are not traced (I read :p0, :myVar, etc...).

How can I do to track the value of these variables if I have not access to the session ?

antferr
  • 100
  • 1
  • 10

1 Answers1

0

You can trace the session and set the LEVEL to capture bind variable values.

SQL> ALTER SESSION SET EVENTS '10046 trace name context forever, level 4'; 

The different LEVELs of tracing event:-

0 – No trace. Like switching sql_trace off.

2 – The equivalent of regular sql_trace.

4 – The same as 2, but with the addition of bind variable values.

8 – The same as 2, but with the addition of wait events.

12 – The same as 2, but with both bind variable values and wait events.

Have a look at How to generate trace file – SQL Trace and TKPROF in Oracle

Lalit Kumar B
  • 47,486
  • 13
  • 97
  • 124