【问题标题】:How to log bind variables on trigger after servererror服务器错误后如何在触发器上记录绑定变量
【发布时间】:2014-10-13 08:24:48
【问题描述】:

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

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

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

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

【问题讨论】:

    标签: oracle plsql bind-variables


    【解决方案1】:

    您可以跟踪会话并设置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.
    

    看看How to generate trace file – SQL Trace and TKPROF in Oracle

    【讨论】:

    • 很遗憾我无法访问该会话
    • 您可以询问您的 DBA 或可以执行此操作的人。跟踪会话将为您提供准确的信息。
    猜你喜欢
    • 1970-01-01
    • 2021-09-20
    • 2017-08-11
    • 2010-10-06
    • 2013-02-06
    • 2012-11-04
    • 2019-09-16
    • 1970-01-01
    • 2012-09-24
    相关资源
    最近更新 更多