ORACLE SQL TUNING ADVISOR

Source: Internet
Author: User

The main steps used by SQL Tunning Advisor:
1 Setting up Tunning task
2 Execute Task
3 showing tunning results
4 Follow the recommendations to run the appropriate tuning method----Advisor Authorization

1 creating tasks based on SQL text

FUNCTION Create_tuning_task (
Sql_text in CLOB,
Bind_list in Sql_binds: = NULL,
User_name in VARCHAR2: = NULL,
Scope in VARCHAR2: = Scope_comprehensive,
Time_limit in Number: = Time_limit_default,
Task_name in VARCHAR2: = NULL,
Description in VARCHAR2: = NULL)
RETURN VARCHAR2;

2 building tasks based on sql_id
FUNCTION Create_tuning_task (
sql_id in VARCHAR2,
Plan_hash_value in Number: = NULL,
Scope in VARCHAR2: = Scope_comprehensive,
Time_limit in Number: = Time_limit_default,
Task_name in VARCHAR2: = NULL,
Description in VARCHAR2: = NULL)
RETURN VARCHAR2;

3 Setting up tasks based on awr snapshot interval and corresponding sql_id
FUNCTION Create_tuning_task (
Begin_snap in number,
End_snap in number,
sql_id in VARCHAR2,
Plan_hash_value in Number: = NULL,
Scope in VARCHAR2: = Scope_comprehensive,
Time_limit in Number: = Time_limit_default,
Ask_name in VARCHAR2: = NULL,
Description in VARCHAR2: = NULL)
RETURN VARCHAR2;

Case:
DECLARE
My_task_name VARCHAR2 (30);
My_sqltext CLOB;
BEGIN
My_sqltext: = ' SELECT 1 from dual ';
My_task_name: = Dbms_sqltune. Create_tuning_task (Sql_text = My_sqltext,
Bind_list=>sql_binds (ANYDATA. Convertnumber (9)),
user_name = ' Noap ',
Scope=> ' comprehensive ',
Time_limit = 600,
Task_name = ' Sql_tuning_test ',
Description=> ' TUNING TASK '
);
END;

BEGIN Dbms_sqltune. Execute_tuning_task (' sql_tuning_test '); END;
SELECT status from user_advisor_tasks WHERE task_name = ' sql_tuning_test ';
SELECT Dbms_sqltune. Report_tuning_task (' Sql_tuning_test ') from DUAL;
BEGIN dbms_sqltune.drop_tuning_task (' sql_tuning_test '); END;

ORACLE SQL TUNING ADVISOR

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.