查询 Oracle 运行的 sql 和绑定变量的值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4888115/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Query Oracle for running sql and value of bind variables
提问by Ken H
If I run the SQL in Fig. 1 below, it may return something like this:
如果我运行下面图 1 中的 SQL,它可能会返回如下内容:
Select fname, lname from name_tbl where nam_key = :key
Without using some fancy DBA trace utility, how can I query an Oracle system table to find the value of the bind variable “:key”?
不使用一些花哨的 DBA 跟踪实用程序,如何查询 Oracle 系统表以找到绑定变量“:key”的值?
Figure 1. - List the current running sql statement.
图 1. - 列出当前正在运行的 sql 语句。
select sid, username, sql_text
from v$session,
v$sqltext
where sql_address = address
and sql_hash_value = hash_value
order by sid, piece;
采纳答案by Lev Khomich
select name, value_string
from v$sql_bind_capture
where sql_id = your_query_id
Upd. or, of course:
更新。或者,当然:
select sql_id, value_string
from v$sql_bind_capture
where name = ':key'