v$sql_bind_capture 獲取繫結變數

gaopengtttt發表於2012-03-19
SQL> connect sys/oracle@mytest172.16.14.29 as sysdba
已連線。
SQL> variable o varchar2(30)
SQL> exec :o :='SYS'

PL/SQL 過程已成功完成。
SQL> select  * from v$mystat;
       SID STATISTIC#      VALUE
---------- ---------- ----------
       309          0          1

SQL> select * from test where USERNAME = :o;
 
另外開啟一個會話
SQL> select PREV_SQL_ID from v$session where sid='309';
 
PREV_SQL_ID
-------------
7awrh0xv2dvfn 
SQL> select value_string from v$sql_bind_capture  where sql_id='7awrh0xv2dvfn';
 
VALUE_STRING
--------------------------------------------------------------------------------
SYS
 

The bind variable contents are refreshed in V$SQL_BIND_CAPTURE at the earliest every 15 minutes. If you require a faster refresh for analysis purposes, you can temporarily set the underlying underscore parameter _CURSOR_BIND_CAPTURE_INTERVAL to a value lower than 900 seconds (-> the default 15 minutes) as follows:

ALTER SYSTEM SET "_CURSOR_BIND_CAPTURE_INTERVAL"=;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7728585/viewspace-719037/,如需轉載,請註明出處,否則將追究法律責任。

相關文章