Skip to content

Instantly share code, notes, and snippets.

@dotmaik1
Created October 6, 2016 16:18
Show Gist options
  • Select an option

  • Save dotmaik1/fa05ea7ae239311ea27bfdc68fbe2565 to your computer and use it in GitHub Desktop.

Select an option

Save dotmaik1/fa05ea7ae239311ea27bfdc68fbe2565 to your computer and use it in GitHub Desktop.
Query Tunning Advisor
SQL statement with SQL_ID 113ffqdfha2gs
declare
stmt_task VARCHAR2(64);
BEGIN
STMT_TASK:=DBMS_SQLTUNE.CREATE_TUNING_TASK(SQL_ID => '7asshajftkyzw', TIME_LIMIT => 300, TASK_NAME => 'Tune_7asshajftkyzw', description => 'Tune task for 7asshajftkyzw');
END;
/
PL/SQL procedure successfully completed.
SQL> execute dbms_sqltune.execute_tuning_task ('Tune_7asshajftkyzw');
PL/SQL procedure successfully completed.
SQL> alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
Session altered.
select task_name, description, advisor_name, execution_start, execution_end, status
from dba_advisor_tasks
where owner='SYS'
ORDER BY task_id DESC;
set linesize 200
set long 999999999
set pages 1000
set longchunksize 20000
select dbms_sqltune.report_tuning_task('Tune_7asshajftkyzw', 'TEXT','ALL') FROM dual;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment