我需要将绑定变量的值跟踪到返回 Oracle 错误的查询。
由于返回错误的查询没有画在v$sql_bind_capture
and中v$sqlarea
,所以我无法查看这些表。
然后我在 Servererror 之后创建了一个触发器,并将查询记录在我创建的跟踪表中。不幸的是,绑定变量没有被跟踪(我读过:p0
,:myVar
等...)。
如果我无法访问会话,我该如何跟踪这些变量的值?
我需要将绑定变量的值跟踪到返回 Oracle 错误的查询。
由于返回错误的查询没有画在v$sql_bind_capture
and中v$sqlarea
,所以我无法查看这些表。
然后我在 Servererror 之后创建了一个触发器,并将查询记录在我创建的跟踪表中。不幸的是,绑定变量没有被跟踪(我读过:p0
,:myVar
等...)。
如果我无法访问会话,我该如何跟踪这些变量的值?
您可以跟踪会话并设置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.