Wednesday, August 17, 2016

Tuning SQL using DBMS_SQLTUNE



DECLARE
  SQL_STRING  VARCHAR2(15000);
  TASK_NUMBER VARCHAR2(200);
BEGIN
  SQL_STRING  := '<<write your sql query>>';
  TASK_NUMBER := dbms_sqltune.create_tuning_task(sql_text => SQL_STRING, task_name=>'TASK_NUMBER1');
END;

EXEC dbms_sqltune.execute_tuning_task('TASK_NUMBER1');

SELECT DBMS_SQLTUNE.report_tuning_task('TASK_NUMBER1') FROM dual; 

... and follow the recommendation

No comments: