ORACLE TRACE 10046
trace 當前程式
方式一
ALTER SESSION SET SQL_TRACE = TRUE ;(exec sys.dbms_support.start_trace ;)
Alter session set events '?10046 trace name context forever, level 12';
--sql
Alter session set events '10046 trace name context off';
ALTER SESSION SET SQL_TRACE = FALSE;(exec sys.dbms_support.stop_trace ;)
方式二
oradebug setmypid xxxx
--sql
oradebug event 10046 trace name context forever, level 12;
oradebug event 10046 trace name context off ;
trace 其他程式
--select a.SID,a.SERIAL# from v$session a where a.SID=&sid
方式一
exec sys.dbms_system.SET_BOOL_PARAM_IN_SESSION(18, 226, 'sql_trace', TRUE);
exec dbms_system.set_ev(18, 226, 10046, 12, '');
--sql
exec dbms_system.set_ev(18, 226, 10046, 0, '');
exec sys.dbms_system.SET_BOOL_PARAM_IN_SESSION(18, 226, 'sql_trace', FALSE);
方式二
exec dbms_system.set_sql_trace_in_session(18,226,TRUE);
exec sys.dbms_monitor.session_trace_enable(session_id=>18,serial_num=>226, waits=>true, binds=>true);
--sql
exec sys.dbms_monitor.session_trace_disable(session_id=>18,serial_num=>226);
exec dbms_system.set_sql_trace_in_session(18,226,FALSE);
注意:以上兩種方式不支援對正在執行的sql進行trace
方式三(oradebug方式)
--select b.SPID from v$session a,v$process b where a.PADDR=b.ADDR and a.SID=&SID;
--獲取os程式id
oradebug setospid xxxx
oradebug event 10046 trace name context forever, level 12;
oradebug tracefile_name
oradebug event 10046 trace name context off ;
10046 EVENT 級別
These are bit values so can be ORed together to get different mixes
1 - Enable standard SQL_TRACE functionality (Default)
4 - As Level 1 PLUS trace bind values [ bind=true ]
8 - As Level 1 PLUS trace waits [ wait=true ]
This is especially useful for spotting latch wait etc.
but can also be used to spot full table scans and index scans.
As of 11g these additional bit levels are available:
16 - Generate STAT line dumps for each execution [ plan_stat=all_executions ]
32 - Never dump execution statistics [ plan_stat=never ]
As of 11.2.0.2 this additional bit level is available:
64 - Adaptive dump of STAT lines. [ plan_stat=adaptive ]
This dumps the STAT information if a SQL took more than about 1 minute thereby
giving information for the more expensive SQLs and for different executions of such
SQLs.
eg: A common event level is 12 which includes standard SQL_TRACE output, binds, waits and
default STAT line tracing.
Notes:
STAT dumping has been amended in 11g so that they are not aggregated across all executions but are
dumped after execution. This has been done to address cases where the cursor is not closed and the
STAT information is therefore not dumped. Now we guarantee to capture the STAT information
following the execution. See the above bit levels to have finer control over STAT lines.
10046輸出內容解釋參考
Interpreting Raw SQL_TRACE output (Doc ID 39817.1)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8494287/viewspace-1357467/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 10046 SQL TRACEOracleSQL
- 單個SQL語句的10046 traceSQL
- Oracle session traceOracleSession
- 【TRACE】如果通過10046跟蹤資料庫效能問題資料庫
- 從10046看Oracle分割槽裁剪Oracle
- 從10046 trace 的trca報告中總結的時間模型示例模型
- Oracle診斷案例-Sql_traceOracleSQL
- 10046事件概述事件
- Oracle清理trace、alert、aud、listener.log檔案Oracle
- oracle清理trace、alert、aud、listener等日誌檔案Oracle
- 10046 tracefile註釋
- 運用Log和Trace檔案排除Oracle Net問題Oracle
- oracle ebs 根據請求id找到對應trace 檔案Oracle
- SQL TraceSQL
- 【TRACE】如何設定或動態跟蹤Oracle net偵聽器Oracle
- oracle 資料庫lsnrctl監聽的日誌路徑和trace檔案Oracle資料庫
- Oracle執行語句跟蹤 使用sql trace實現語句追蹤OracleSQL
- DBMS_TRACE(zt)
- 用10046進行診斷一例
- Android Framework: 增加trace點AndroidFramework
- Chromium Trace and Perfetto使用詳解
- Matrix原始碼分析————Trace Canary原始碼
- [20200818]12c 10046跟蹤時間戳.txt時間戳
- [20180417]使用10046事件需要什麼許可權.txt事件
- Istio Trace鏈路追蹤方案
- sql_trace相關指令碼SQL指令碼
- Android Perfetto 系列 2:Perfetto Trace 抓取Android
- 【dubbo3.x trace元件分享】元件
- [20200818]12c 10046跟蹤時間戳2.txt時間戳
- 從v$diag_info定位trace file
- ADFS – How to enable Trace Debugging and advanced access logging
- Netweaver和CloudFoundry裡的trace開關Cloud
- Finding Trace Files v$diag_info & TKPROF
- debug:am trace-ipc原始碼分析原始碼
- 手把手教你認識OPTIMIZER_TRACE
- Golang 大殺器之跟蹤剖析 traceGolang
- onethink的頁面trace如何調出來
- 一個快速檢視trace的小指令碼指令碼
- Trace file的命名規則和存放路徑