0% found this document useful (0 votes)
49 views1 page

Steps To Configure SQL Tuning Advisor

The document discusses tuning a SQL statement using the SQL Tuning Advisor. It shows how to: 1) Identify the SQL ID of the statement to tune from V$SQL; 2) Create a tuning task using DBMS_SQLTUNE.create_tuning_task, specifying the SQL ID, scope, time limit, and task name; 3) Execute the tuning task using DBMS_SQLTUNE.execute_tuning_task; 4) Verify task completion status in DBA_ADVISOR_LOG; 5) Generate and view the tuning report using DBMS_SQLTUNE.REPORT_TUNING_TASK.

Uploaded by

Mouloud AFOUAAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views1 page

Steps To Configure SQL Tuning Advisor

The document discusses tuning a SQL statement using the SQL Tuning Advisor. It shows how to: 1) Identify the SQL ID of the statement to tune from V$SQL; 2) Create a tuning task using DBMS_SQLTUNE.create_tuning_task, specifying the SQL ID, scope, time limit, and task name; 3) Execute the tuning task using DBMS_SQLTUNE.execute_tuning_task; 4) Verify task completion status in DBA_ADVISOR_LOG; 5) Generate and view the tuning report using DBMS_SQLTUNE.REPORT_TUNING_TASK.

Uploaded by

Mouloud AFOUAAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

SQL1: SQL> select e.first_name, d.department_name, l.

city "Tag01" from employees e,


de
partments d , locations l where e.salary > 1000 order by 1;

## Etape1: Recupérer l'ID de l'isntruction


SQL> SELECT sql_id,sl_text FROM V$SQL WHERE SQL_TEXT LIKE '%Tag01%';

recupérer le code hash sql_id=............................ ?


## Créer la task

DECLARE
v_sql_tune_task_id VARCHAR2(100);
BEGIN
v_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task (
sql_id => 'bxuh5yrqz7u9d',
scope => DBMS_SQLTUNE.scope_comprehensive,
time_limit => 1000,
task_name => 'test_tuning_task_1',
description => 'My Tuning task pour SQL
ID:bxuh5yrqz7u9d');
DBMS_OUTPUT.put_line('v_sql_tune_task_id: ' || v_sql_tune_task_id);
END;
/

## Executer la task

SQL> EXECUTE DBMS_SQLTUNE.execute_tuning_task(task_name => 'test_tuning_task_1');

## Verifier si statut completed


SQL> SELECT TASK_NAME, STATUS FROM DBA_ADVISOR_LOG WHERE
UPPER(TASK_NAME)='TEST_TUNING_TASK_1'

-- TASK_NAME STATUŞ
------------------------------ -----------
-- test_tuning_task COMPLETED

## voir le rapport
SET LONG 65300
SET LONGCHUNKSIZE 65300
SET LINESIZE 200
spool c:\app\dba1\advisor01.txt
SELECT DBMS_SQLTUNE.REPORT_TUNING_TASK( 'test_tuning_task_1' ) FROM DUAL;
spool off

## ## consulter le rapport c:\app\dba1\advisor01.txt


## Verifier la section des Findings (recommendations) du sql advisor

You might also like