Oracle SQL trace with bind variables

How to get full SQL statement with bind variables replaced from trace file?

When setting up

ALTER SESSION SET EVENTS '10046 trace name context forever, level 4';
ALTER SESSION SET sql_trace = true;

the resulting trace file contains an SQL query with bind variables and the resolution of the bind variables in a separate "BINDS" section. This is normal if there are a couple of binding variables. This is not very useful when I have another 100 bind variables.

Tkprof processes the trace file, but does not support bind variables.

Is it possible to get full SQL statements with replaceable bind variables so that I can easily copy-paste and re-execute it? Maybe a free tool that will process my trace file and output full SQL statements?

I would also evaluate the solution without SQL tracing, using v $ sql and friends instead.

+3
source share
1 answer

You need to use the Oracle trace analyzer instead of tkprof to extract the actual values ​​of the binding variables. http://www.rampant-books.com/art_moore_oracle_trace_analyzer_trcanlzr_sql.htm

a trace analyzer will replace tkprof in the future.

+3
source

Source: https://habr.com/ru/post/1753118/


All Articles