透過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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 透過ADDM進行SQL調優SQL
- Script to generate AWR report from remote sql clientREMSQLclient
- statspack report分析(AWR也可參考)
- Oracle 10g AWR Report 分析(轉)Oracle 10g
- Awr Report Memory Advisory分析介紹
- AWR Report 自動生成指令碼 [final]指令碼
- [Shell] 自動生成oracle awr report並mail出來OracleAI
- 使用sql monitor獲取更加詳細的執行計劃 - dbms_sqltune.report_sql_monitorSQL
- 通過ADDM進行SQL調優SQL
- oracle小知識點5--通過dbms_workload_repository.awr_report_html產生awr報告OracleHTML
- 【BUG】Oracle12c tablespace io statistics missing from awr reportOracle
- “How to Save Report To Excel” 技術改進Excel
- 透過addm分析io問題
- statspack report分析
- Standby Database for reportDatabase
- Oracle Statspack ReportOracle
- [shell] execute remote Script自動生成oracle awr report並mail出來REMOracleAI
- 如何使用awr_set_report_thresholds控制AWR報告裡的sql語句數量SQL
- Jest-Vue-ReportVue
- EBS SQL --> Form & ReportSQLORM
- ituring Error ReportError
- 系統bug report
- android junit reportAndroid
- statspack report分析 (zt)
- statspack、awr、addm,ash影片分享
- Oracle 10g,AWR,AWR,ADDM最佳實踐Oracle 10g
- [轉]Pentaho:Create a Report with MongoDBMongoDB
- android bug report toolsAndroid
- Haskell Communities and Activities ReportHaskell
- rman report list crosscheck deleteROSdelete
- Save and Edit a Report Specification locally
- Crystal report trainingAI
- AWR、ASH、ADDM和顧問程式
- ASH、AWR、ADDM區別聯絡
- statspack、awr、addm,ash視訊分享
- Salesforce Admin篇(二) ReportSalesforce
- SQL Monitor Report 使用詳解SQL
- To view information if a process abends without a reportViewORM