Run autotuning task for a SQL query
-- create tuning task DECLARE stmt_task VARCHAR2(64); BEGIN stmt_task:=dbms_sqltune.create_tuning_task(sql_id => '&sql_id', plan_hash_value => '&plan_hash', time_limit => 7200, task_name => '&task_name', description => 'Task to tune sql query'); END; / -- execute tuning task EXECUTE dbms_sqltune.execute_tuning_task('&task_name'); -- report tuning task SET linesize 200 SET LONG 999999999 SET pages 1000 SET longchunksize 20000 SELECT dbms_sqltune.report_tuning_task('&task_name', 'TEXT', 'ALL') FROM dual;