基於AWR對特定的SQL_ID檢視詳細的歷史執行情況
set verify on lines 200 pages 9999
undefine sqlid
accept level char DEFAULT 'ADVANCED' PROMPT "Explain Plan level (BASIC, TYPICAL, ALL, ADVANCED) (Default : ADVANCED) : "
col cpu_exe format 9999.9999
col ela_exe format 9999.9999
col prds_exe format 9999.9999
col bg_exe format 99999999
col rows_exe format 999999
col snap_time format a14
col inst format 999
col sql_id new_value sqlid noprint
break on plan_hash_value skip 1
select
sql_id,
plan_hash_value,
s.instance_number inst,
s.snap_id,
to_char(s.begin_interval_time,'YYYYMMDD:HH24:MI') snap_time,
executions_delta delta_exe,
cpu_time_delta/1000000 delta_cpu_sec,
(case when executions_delta>0 then ((cpu_time_delta/1000000)/executions_delta) else 0 end) cpu_exe,
(case when executions_delta>0 then ((elapsed_time_delta/1000000)/executions_delta) else 0 end) ela_exe,
(case when executions_delta>0 then (buffer_gets_delta/executions_delta) else 0 end) bg_exe,
(case when executions_delta>0 then (disk_reads_delta/executions_delta) else 0 end) prd_exe,
(case when executions_delta>0 then (rows_processed_delta/executions_delta) else 0 end) rows_exe
from
dba_hist_sqlstat b,
dba_hist_snapshot s
where
b.sql_id = '&sqlid'
and b.snap_id = s.snap_id
and s.begin_interval_time >= sysdate-&days_back
and s.instance_number = b.instance_number
order by
2,3,4
;
select * from table(dbms_xplan.display_awr('&sqlid','','','&level'))
;
undefine sqlid
clear columns
clear breaks
undefine sqlid
accept level char DEFAULT 'ADVANCED' PROMPT "Explain Plan level (BASIC, TYPICAL, ALL, ADVANCED) (Default : ADVANCED) : "
col cpu_exe format 9999.9999
col ela_exe format 9999.9999
col prds_exe format 9999.9999
col bg_exe format 99999999
col rows_exe format 999999
col snap_time format a14
col inst format 999
col sql_id new_value sqlid noprint
break on plan_hash_value skip 1
select
sql_id,
plan_hash_value,
s.instance_number inst,
s.snap_id,
to_char(s.begin_interval_time,'YYYYMMDD:HH24:MI') snap_time,
executions_delta delta_exe,
cpu_time_delta/1000000 delta_cpu_sec,
(case when executions_delta>0 then ((cpu_time_delta/1000000)/executions_delta) else 0 end) cpu_exe,
(case when executions_delta>0 then ((elapsed_time_delta/1000000)/executions_delta) else 0 end) ela_exe,
(case when executions_delta>0 then (buffer_gets_delta/executions_delta) else 0 end) bg_exe,
(case when executions_delta>0 then (disk_reads_delta/executions_delta) else 0 end) prd_exe,
(case when executions_delta>0 then (rows_processed_delta/executions_delta) else 0 end) rows_exe
from
dba_hist_sqlstat b,
dba_hist_snapshot s
where
b.sql_id = '&sqlid'
and b.snap_id = s.snap_id
and s.begin_interval_time >= sysdate-&days_back
and s.instance_number = b.instance_number
order by
2,3,4
;
select * from table(dbms_xplan.display_awr('&sqlid','','','&level'))
;
undefine sqlid
clear columns
clear breaks
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29446986/viewspace-1431525/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle檢視sql_id 的歷史執行計劃OracleSQL
- 透過SQL_ID檢視SQL歷史執行資訊SQL
- 通過SQL_ID檢視SQL歷史執行資訊SQL
- 【AWR】DBA_HIST檢視檢視儲存在AWR中的歷史資料
- 【最佳化】檢視歷史的執行計劃之檢視AWR報告
- OushuDB 檢視查詢執行情況
- UNIX如何檢視執行緒執行情況執行緒
- 檢視歷史執行計劃
- 基於dba_hist_sqlstat檢視sql語句的效能歷史SQL
- 檢視sql 執行計劃的歷史變更SQL
- 二、GIT基礎-檢視提交歷史Git
- 檢視Oracle回滾段的詳細情況,以及對效能的影響 -- 轉Oracle
- Git 檢視檔案的歷史Git
- 檢視歷史會話等待事件對應的session資訊會話事件Session
- Oracle中檢視sql命令歷史,檢視rman命令歷史OracleSQL
- 【Oracle】如何檢視sql 執行計劃的歷史變更OracleSQL
- git檢視提交歷史Git
- Git 檢視提交歷史Git
- git檢視歷史命令Git
- IOS 特定於裝置的開發:基於加速計的滾動檢視iOS
- Git(7)-- 檢視提交歷史(git log 命令詳解)Git
- Oracle錶的歷史統計資訊檢視Oracle
- Oracle檢視歷史TOP SQLOracleSQL
- zt_導回awr報告中的歷史執行計劃
- 根據SQL_ID檢視執行計劃SQL
- 詳細的AWR解析報告
- 在Linux中,如何檢視磁碟詳細使用情況?Linux
- Git檢視某個歷史版本的最佳實踐Git
- git log檢視提交歷史記錄Git
- git簡略形式檢視提交歷史Git
- 檢視Spark任務的詳細資訊Spark
- 下載歷史版本 App 超詳細教程APP
- 歷史的回顧:HP-UX系統概況和版本歷史UX
- Git新手教程-檢視倉庫的歷史記錄(四)Git
- 來回修改的文件,怎麼檢視、管理歷史版本?
- prepareStatement和Statement執行批處理的執行情況REST
- win10怎樣看歷史記錄_win10檢視歷史記錄的方法Win10
- 【第八篇】- Git 檢視提交歷史Git