透過AWR REPORT 或 ADDM REPORT進行SQLTUNE
1.建立SQL TUNE任務
SET SERVEROUTPUT ON
DECLARE
l_sql_tune_task_id VARCHAR2(100);
BEGIN
l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task (
sql_id => 'aaz58jt1sgjk3',
scope => DBMS_SQLTUNE.scope_comprehensive,
time_limit => 60,
task_name => 'aaz58jt1sgjk3_tuning_task',
description => 'Tuning task for statement aaz58jt1sgjk3.');
DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
END;
/
2.執行任務,並檢視執行狀態
EXEC DBMS_SQLTUNE.EXECUTE_TUNING_TASK( task_name => 'aaz58jt1sgjk3_tuning_task' );
SELECT task_name, status FROM dba_advisor_log WHERE owner = 'SYS' and task_name='aaz58jt1sgjk3_tuning_task';
3.檢視SQLTUNE報告
SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( 'aaz58jt1sgjk3_tuning_task') FROM DUAL;
4.根據SQLTUNE結果,選擇透過SQL PROFILE來最佳化執行計劃或透過所給的建議來更改SQL語句
-------------------------------------------------------------------------------
FINDINGS SECTION (2 findings)
-------------------------------------------------------------------------------
1- SQL Profile Finding (see explain plans section below)
--------------------------------------------------------
A potentially better execution plan was found for this statement.
Recommendation (estimated benefit<=10%)
---------------------------------------
- Consider accepting the recommended SQL profile.
execute dbms_sqltune.accept_sql_profile(task_name =>
'aaz58jt1sgjk3_tuning_task', replace => TRUE);
2- Restructure SQL finding (see plan 1 in explain plans section)
----------------------------------------------------------------
An expensive "UNION" operation was found at line ID 6 of the execution plan.
Recommendation
--------------
- Consider using "UNION ALL" instead of "UNION", if duplicates are allowed
or uniqueness is guaranteed.
Rationale
---------
"UNION" is an expensive and blocking operation because it requires
elimination of duplicate rows. "UNION ALL" is a cheaper alternative,
assuming that duplicates are allowed or uniqueness is guaranteed.
-------------------------------------------------------------------------------
ADDITIONAL INFORMATION SECTION
-------------------------------------------------------------------------------
- The optimizer could not merge the view at line ID 5 of the execution plan.
The optimizer cannot merge a view that contains a set operator.
- The optimizer could not merge the view at line ID 3 of the execution plan.
The optimizer cannot merge a view that contains an "ORDER BY" clause unless
the statement is a "DELETE" or an "UPDATE" and the parent query is the top
most query in the statement.
- The optimizer could not merge the view at line ID 1 of the execution plan.
The optimizer cannot merge a view that contains a "ROWNUM" pseudo column.
Reference:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/789833/viewspace-1056855/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20200115]重新建立awr report.txt
- 使用sql monitor獲取更加詳細的執行計劃 - dbms_sqltune.report_sql_monitorSQL
- 【BUG】Oracle12c tablespace io statistics missing from awr reportOracle
- statspack、awr、addm,ash影片分享
- Jest-Vue-ReportVue
- Salesforce Admin篇(二) ReportSalesforce
- 會說話的ABAP report
- jenkins -pipeline 執行 jmeter 指令碼 publish report 失敗JenkinsJMeter指令碼
- Java程式生成linechart report的方法Java
- 瞭解和分析iOS Crash ReportiOS
- 排除anaconda的report false問題False
- plsql developer工具生成sql monitor reportSQLDeveloper
- 使用Report Builder 3.0配置指標KYUI指標
- Beautifulreport 使用中報 line380,in report self.output_report () 等錯誤,麻煩大家幫忙解決
- Bitcoin-ABC incident report (26APR2018)IDE
- Oracle SQL調優系列之SQL Monitor ReportOracleSQL
- jenkins 釋出 html report 失敗 (急求)JenkinsHTML
- Dynamics CRM 2016 404 error before any report runsError
- 在 Github Action 管道內整合 Code Coverage ReportGithub
- Grid++Report 元件使用最簡程式碼元件
- toad使用(檢視alert日誌、Database Report)Database
- 遷移Report Server DataBase時遇到的坑ServerDatabase
- 【Selenium + Python】路徑報錯之OSError: [Errno 22] Invalid argument: './t/report/2018-03-23_11:03:12_report.html'PythonErrorHTML
- 如何在CRM WebClient UI裡使用HANA Live ReportWebclientUI
- Error waiting for a debug connection: ProcessException: adb did not report forwarded portErrorAIExceptionForward
- 如何在SAP WebClient UI裡使用HANA Live reportWebclientUI
- 筆記:異常處理之report與render筆記
- WPF 透過 SetWindowDisplayAffinity 配置禁止對視窗進行截圖或錄屏
- Jenkins上實現Python + Jenkins + Allure Report 介面自動化測試持續整合,並生成allure-report測試報告JenkinsPython測試報告
- 透過 OKR 進行專案過程管理OKR
- ADDM
- idou老師教你學Istio 27:解讀Mixer Report流程
- Jenkins allure report 路徑使用環境變數失敗Jenkins變數
- 解決 httprunner2 無法使用 extent_report_templateHTTP
- Demand Gen Report:2021年需求生成基準報告
- 透過.PAC進行網路釣魚
- 透過dns進行檔案下載DNS
- idou老師教你學istio 31:Istio-proxy的report流程
- Demand Gen Report:潛在客戶培養調查報告