0

我需要将绑定变量的值跟踪到返回 Oracle 错误的查询。

由于返回错误的查询没有画在v$sql_bind_captureand中v$sqlarea,所以我无法查看这些表。

然后我在 Servererror 之后创建了一个触发器,并将查询记录在我创建的跟踪表中。不幸的是,绑定变量没有被跟踪(我读过:p0,:myVar等...)。

如果我无法访问会话,我该如何跟踪这些变量的值?

4

1 回答 1

0

您可以跟踪会话并设置LEVEL捕获绑定变量值。

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

LEVELs跟踪事件的不同之处:-

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.

看看如何生成跟踪文件——Oracle 中的 SQL Trace 和 TKPROF

于 2014-10-13T08:39:02.340 回答