Use instances of SQL Tuning Advisor in Oracle

Source: Internet
Author: User

Before oracle10g, it would be a hassle to optimize an SQL statement, but the SQL Tuning Advisor tool, introduced in oracle10g this release, would significantly reduce the workload of SQL tuning, but to use SQL Tuning Advisor, Make sure your optimizer is a CBO model.

1. First you need to create a user bamboo for tuning and give advisor to the user you created

Sql> create user bamboo identified by bamboo;

User created.

Sql> grant Connect,resource to bamboo;

Grant succeeded.

Sql> grant advisor to bamboo;

Grant succeeded.

2. Create the user to do the test of the 2 tables, the large table inserted 5 million data, small table inserted 100,000 data, its creation method as follows

Sql> CREATE TABLE BigTable (ID number (), name VARCHAR2 (100));

Table created.

Sql> begin

2 for I in 1..5000000 loop

3 INSERT INTO bigtable values (i, ' Test ' | | i);

4 End Loop;

5 end;

6/

Pl/sql procedure successfully completed.

Sql> Commti;

Sql> CREATE TABLE smalltable (ID number (), name VARCHAR2 (100));

Table created.

Sql> begin

2 for I in 1..100000 loop

3 INSERT into smalltable values (i, ' Test ' | | i);

4 End Loop;

5 end;

6/

Pl/sql procedure successfully completed.

Sql> Commti;

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.