Oracle Learning SQL sharing and 4031 solutions

Source: Internet
Author: User

"Shared sql:

1. Unified writing Style

2. Using bound variables

"To find the SQL statement that is not shared:

Look for SQL statements with smaller executions in v$sql to see if these SQL statements are executed frequently.

Select Sql_fulltext from V$sql where Executions=1 and sql_text like '%from t% ';

Select Sql_fulltext from V$sql where Executions=1 order by Sql_text; --List the statements with only one execution times, and sort

"Analytic hit ratio:

Select SUM (pinhits)/sum (Pins) *100 from V$librarycache; --Soft parsing

Select sum (gets), sum (getmisses), 100*sum (gets-getmisses)/sum (gets) from V$rowcache where gets>0;

"Resolves the 4031 error method

1, alter system flush Shared_pool; --Temporary means

2. Shared SQL

Alter system set cursor_sharing= ' force ';

3. Select * from V$db_object_cache where Sharable_mem > 10000

and (type = ' package ' or type= ' package BODY ' or type= ' FUNCTION ' or type= ' PROCEDURE ')

and kept = ' NO ';

Executes the Dbms_shared_pool.keep (' object name from the previous statement ');

Dbms_shared_pool

@?/rdbms/admin/dbmspool.sql

4. Reserved area

Select Request_misses from v$shared_pool_reserved;

Show parameter gkfx;

5. Add Shared Pool space

Select Component,current_size from V$sga_dynamic_components;

Show Parameter Sga_target

Show Parameter Sga_max_size

Alter system set SHARED_POOL_SIZE=150M scope=both;--oracle will be 159M by default and can only be modified to be larger than 159M

Oracle Learning SQL sharing and 4031 solutions

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.