如何獲取繫結變數值
Bind Capture History
As of 10g, Oracle captures the bind value and stores it into the repository(AWR), but with following restrictions.
- Captured periodically(_cursor_bind_capture_interval), not at real time.
- Captured under maximum size(_cursor_bind_capture_area_size)
- Only bind variables in WHERE clause are captured
Ouch! Too many restrictions, aren’t they?
Simple demonstration:
UKJA@ukja102> var bid1 number; UKJA@ukja102> var eid1 number; UKJA@ukja102> UKJA@ukja102> exec :bid1 := dbms_workload_repository.create_snapshot; PL/SQL procedure successfully completed. UKJA@ukja102> UKJA@ukja102> var b1 number; UKJA@ukja102> var b2 number; UKJA@ukja102> var b3 varchar2(1); UKJA@ukja102> begin 2 :b1 := 1; 3 :b2 := 2000; 4 :b3 := 'y'; 5 end; 6 / PL/SQL procedure successfully completed. UKJA@ukja102> UKJA@ukja102> update t1 set c3 = :b3 where c1 between :b1 and :b2; 2000 rows updated. UKJA@ukja102> commit; Commit complete. UKJA@ukja102> UKJA@ukja102> exec :eid1 := dbms_workload_repository.create_snapshot; PL/SQL procedure successfully completed. UKJA@ukja102> UKJA@ukja102> var sql_id varchar2(100); UKJA@ukja102> begin 2 select sql_id into :sql_id 3 from dba_hist_sqltext 4 where sql_text like 'update t1 set c3 = :b3 where c1 between :b1 and :b2'; 5 end; 6 / PL/SQL procedure successfully completed. UKJA@ukja102> UKJA@ukja102> print sql_id SQL_ID -------------------------------------------------------------------------------- bvy5d4xupjkku UKJA@ukja102> UKJA@ukja102> col name format a10 UKJA@ukja102> col position format 99 UKJA@ukja102> col value_string format a20 UKJA@ukja102> select snap_id, name, position, value_string, last_captured - > from dba_hist_sqlbind 2 where sql_id = :sql_id 3 order by snap_id desc; SNAP_ID NAME POSITION VALUE_STRING LAST_CAPTURED ---------- ---------- -------- -------------------- ------------------- 6701 :B1 2 1 2009/05/06 11:10:13 6701 :B2 3 2000 2009/05/06 11:10:13 6701 :B3 1 6700 :B2 3 1000 2009/05/06 11:10:03 6700 :B3 1 6700 :B1 2 1 2009/05/06 11:10:03 6699 :B1 2 1 2009/05/06 11:05:50 6699 :B3 1 6699 :B2 3 2000 2009/05/06 11:05:50 6697 :B2 3 2000 2009/05/06 10:47:51 6697 :B3 1 6697 :B1 2 1 2009/05/06 10:47:51 12 rows selected.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22034023/viewspace-688706/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE 獲取繫結變數值Oracle變數
- 如何獲取繫結變數變數
- 獲取sql繫結變數的值SQL變數
- 如何獲取變數token的值變數
- 如何獲取變數 token 的值變數
- Oracle獲取繫結變數的各種方法Oracle變數
- v$sql_bind_capture 獲取繫結變數SQLAPT變數
- 如何用FGA得到繫結變數的值變數
- 如何得到繫結變數的輸入值變數
- v$sql_bind_capture 獲取繫結變數資訊SQLAPT變數
- 查詢繫結變數的值變數
- 【EVENT】使用10046事件獲取SQL語句中繫結變數的具體值事件SQL變數
- 關於繫結變數的SQL繫結什麼值變數SQL
- 轉貼_使用10046事件獲取SQL語句中繫結變數的具體值事件SQL變數
- oracle資料庫獲取繫結變數的各種方法Oracle資料庫變數
- 繫結變數變數
- Oracle9i, 10g 如何抓取繫結變數的值Oracle變數
- 繫結變數之繫結變數窺探(Bind Peeking)變數
- Oracle 繫結變數Oracle變數
- 如何在對in操作使用變數繫結(轉)變數
- js_獲取與設定css變數的值JSCSS變數
- 如何獲取cookie值Cookie
- 檢視繫結變數變數
- 繫結變數窺測變數
- PLSQL使用繫結變數SQL變數
- Oracle之繫結變數Oracle變數
- 關於繫結變數變數
- 【優化】使用繫結變數 OR 不使用繫結變數,這不是問題!優化變數
- ORACLE 繫結變數用法總結Oracle變數
- 【最佳化】使用繫結變數 OR 不使用繫結變數,這不是問題!變數
- javascript如何獲取url傳遞的引數值JavaScript
- 繫結變數窺測的演變變數
- Oracle 變數繫結與變數窺視合集Oracle變數
- 繫結變數的測試變數
- Oracle 繫結變數窺探Oracle變數
- oracle 繫結變數(bind variable)Oracle變數
- Oracle 繫結變數 詳解Oracle變數
- jQuery獲取url引數值jQuery