--:自动调优计划
begin
dbms_workload_repository.create_snapshot();
end;
select /*+ result_cache */ count(*) from (select * from HJ.dbtan where object_type=‘TABLE‘ ORDER BY 1 DESC ,2 ASC ,3 DESC ,4 ASC);
begin
dbms_workload_repository.create_snapshot();
end;
--ft8s1pfmz9ph0
SET SERVEROUTPUT ON
DECLARE
l_sql_tune_task_id VARCHAR2(100);
BEGIN
l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task (
begin_snap => 21,
end_snap => 22,
sql_id => ‘ft8s1pfmz9ph0‘,
scope => DBMS_SQLTUNE.scope_comprehensive,
time_limit => 300,
task_name => ‘ft8s1pfmz9ph0d_AWR_tuning_task‘,
description => ‘Tuning task for statement f3hc7r4trnn1d in AWR.‘);
DBMS_OUTPUT.put_line(‘l_sql_tune_task_id: ‘ || l_sql_tune_task_id);
END;
begin DBMS_SQLTUNE.execute_tuning_task(task_name => ‘ft8s1pfmz9ph0d_AWR_tuning_task‘);end;
SELECT DBMS_SQLTUNE.report_tuning_task(‘ft8s1pfmz9ph0d_AWR_tuning_task‘) AS recommendations FROM dual;
GENERAL INFORMATION SECTION
-------------------------------------------------------------------------------
Tuning Task Name : ft8s1pfmz9ph0d_AWR_tuning_task
Tuning Task Owner : SYS
Workload Type : Single SQL Statement
Scope : COMPREHENSIVE
Time Limit(seconds): 300
Completion Status : COMPLETED
Started at : 09/01/2014 14:55:32
Completed at : 09/01/2014 14:55:44
-------------------------------------------------------------------------------
Schema Name: SYS
SQL ID : ft8s1pfmz9ph0
SQL Text : select /*+ result_cache */ count(*) from (select * from
HJ.dbtan where object_type=‘TABLE‘ ORDER BY 1 DESC ,2 ASC ,3
DESC ,4 ASC)