带有绑定变量的 Oracle SQL 跟踪
如何获取完整的 SQL 语句并从跟踪文件中替换绑定变量?
设置时,
ALTER SESSION SET EVENTS '10046 trace name context forever, level 4';
ALTER SESSION SET sql_trace = true;
生成的跟踪文件在单独的“BINDS”部分中包含带有绑定变量的 SQL 查询和绑定变量的解析。如果有几个绑定变量,这很好。当我有 100 多个绑定变量时,它不是很有用。
Tkprof 处理跟踪文件,但不支持绑定变量。
是否可以获取完整的 SQL 语句并替换绑定变量,以便我可以轻松地复制粘贴并重新执行它?是否有一个免费工具可以处理我的跟踪文件并输出完整的 SQL 语句?
我也很欣赏使用 v$sql 和朋友来代替 SQL 跟踪的解决方案。
How to aquire the full SQL statement with bind variables substituted from a trace file?
When setting
ALTER SESSION SET EVENTS '10046 trace name context forever, level 4';
ALTER SESSION SET sql_trace = true;
the resulting trace file contains the SQL query with bind variables and the resolution of the bind variables in a separate "BINDS" section. This is fine if there are a couple of bind variables. It's not very useful when I have 100+ bind variables.
Tkprof processes the trace file but does not support bind variables.
Is it possible to get the full SQL statements with the bind variables substituted so I can easily copy-paste and re-execute it? Is there maybe a free tool that will process my trace file and output the full SQL statements?
I'd also appreciate a solution without SQL tracing using v$sql and friends instead.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用 Oracle 跟踪分析器而不是 tkprof 来提取绑定变量的实际值。 http://www.rampant-books.com/art_moore_oracle_trace_analyzer_trcanlzr_sql.htm
跟踪分析器是将来最终将取代 tkprof。
You need to use Oracle trace analyzer instead of tkprof to extract actual values of bind variables. http://www.rampant-books.com/art_moore_oracle_trace_analyzer_trcanlzr_sql.htm
trace analyzer is going to replace eventually tkprof in future.