MONITOR
/*+ MONITOR */
11g R1 ~
Oracle11gでReal-Time SQL Monitoring機能が追加されました。Real-Time SQL Monitoringと実行時間が5秒以上(_SQLMON_THRESHOLD隠しパラメータで調整)であるすべてのクエリの実行履歴情報をV$ SQL_MONITORビューとV$ SQL_PLAN_MONITORビューに残します。このビューに記録された結果は、dbms_sqltune.report_sql_monitor関数を利用して簡単に再生することができます。
この機能を利用すれば、10046 TraceやSQL Traceを使用せずに、クエリの実行をリアルタイムで追跡することが可能となります。
select /*+ monitor */ * from t_monitor where id between 10 and 100; select dbms_sqltune.report_sql_monitor from dual; SQL Monitoring Report SQL Text ----------------------------------------------------------------------- select /*+ monitor */ * from t_monitor where id between 10 and 100 ----------------------------------------------------------------------- Global Information Status : DONE (FIRST N ROWS) Instance ID : 1 Session ID : 138 SQL ID : 82y00763xckxr SQL Execution ID : 16777216 Plan Hash Value : 2788854221 Execution Started : 01/17/2008 17:59:28 First Refresh Time : 01/17/2008 17:59:28 Last Refresh Time : 01/17/2008 17:59:30 --------------------------------------- | Elapsed | Other | Fetch | Buffer | | Time(s) | Waits(s) | Calls | Gets | --------------------------------------- | 0.00 | 0.00 | 2 | 5 | ---------------------------------------
SQL Plan Monitoring Details
Id | Operation | Name | Rows (Estim) |
Cost | Time Active(s) |
Start Active |
Starts | Row (Actual) |
Activity (percent) |
Activity Detail (sample#) |
---|---|---|---|---|---|---|---|---|---|---|
0 | SELECT STATEMENT | 3 | 1 | |||||||
1 | TABLE ACCESS BY INDEX ROWID | T_MONITOR | 92 | 3 | 1 | |||||
2 | INDEX RANGE SCAN | T_MONITOR_IDX | 92 | 2 | 1 | +0 | 1 | 50 |