How to clear the execution plan of an SQL statement in the share pool in Oracle 11g

Source: Internet
Author: User

How to clear the execution plan of an SQL statement in the share pool in Oracle 11g

In the past, if the execution plan was slow due to binding snoop on Oracle 10 Gb database, you wanted to clear the execution plan of an SQL statement and make it hard to parse it, after searching for a long time, I did not find the method to directly operate the share pool (the system flush shared_pool cannot be used in all cases). I can only use table ddl to make SQL hard parsing. Now we have found that sys. dbms_shared_pool.purge can be used directly at 11g, but alter session set events '5614566 trace name context forever 'is required at 10g '.

SQL> select * from v $ version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production
PL/SQL Release 11.2.0.1.0-Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0-Production
NLSRTL Version 11.2.0.1.0-Production
SQL> drop table test purge;
SQL> create table test as select * from dba_objects;
SQL> exec dbms_stats.gather_table_stats (user, 'test ');
SQL> select/* gg */count (*) from test;
COUNT (*)
----------
79747
SQL> col SQL _TEXT format a35
SQL> col ADDRESS format a18
SQL> col HASH_VALUE format a10
SQL> select s. SQL _TEXT, s. ADDRESS, s. HASH_VALUE |''
From v $ sqlarea s
Where SQL _text like 'select/* gg */count (*) from test % ';
SQL _TEXT ADDRESS S. HASH_VALUE |''
-------------------------------------------------------------------------------------
Select/* gg */count (*) from test 0000000300B06D70 728448230
SQL> exec sys. dbms_shared_pool.purge ('0000000300b06d70, 100', 'C ');
The PL/SQL process is successfully completed.
SQL> select s. SQL _TEXT, s. ADDRESS, s. HASH_VALUE |''
From v $ sqlarea s
Where SQL _text like 'select/* gg */count (*) from test % ';
Unselected row

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.