SQL Tuning , "SQL Tuning"
--##################################################
-- From Current SQL
-- Note Try Runnning from the Correct Instance and
-- May be directly from the server
--##################################################
DECLARE
l_sql_tune_task_id VARCHAR2(100);
BEGIN
l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task (
sql_id => 'bd64yscq8sayf',
scope => DBMS_SQLTUNE.scope_comprehensive,
time_limit => 2500,
task_name => 'bd64yscq8sayf_5',
description => 'bd64yscq8sayf');
DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
END;
/
--SELECT * FROM DBA_ADVISOR_TASKS where task_name='cgm9r2w1fgkbh';
EXEC DBMS_SQLTUNE.execute_tuning_task(task_name => 'cgm9r2w1fgkbh_6');
SELECT DBMS_SQLTUNE.report_tuning_task('bd64yscq8sayf_6') AS recommendations FROM dual;