Summary of the hit rate query statements of the Oracle database

Source: Internet
Author: User

Summary of the hit rate query statements of the Oracle database

1) hit rate of Library Cache
Formula: Library Cache Hit Ratio = SUM (PINHITS)/SUM (PINS)
Select sum (PINHITS)/SUM (PINS) from v $ LIBRARYCACHE;

The hit rate cannot be lower than 99%. Otherwise, you need to consider whether it is affected by factors such as the size of the shared pool, the bound variable, and cursor_sharing.
Select name, value from v $ parameter where name = 'cursor _ sharing'

2) Shared Pool usage
Formula: Shared Pool Hit Ratio = (100-Free memory/shared_pool_size * 100) %
If the database uses AMM to manage memory, use the following statement to obtain the Shared Pool size:

Select pool, ROUND (SUM (BYTES)/1024/1024, 2) from v $ SGASTAT where POOL = 'shared pooled 'group by pool;

If you use Manual to manage the memory:
Select name, value from v $ parameter where name = 'shared _ pool_size ';

Query 1:

SELECT 100-ROUND (select round (SUM (BYTES)/1024/1024, 2) BYTES
From v $ SGASTAT
Where name = 'free memory'
And pool = 'shared pool'
Group by pool)/ROUND (SUM (BYTES)/1024/1024, 2 ),
(4) * 100 | '%' RATIOS
From v $ SGASTAT
Where POOL = 'shared pool'
GROUP BY POOL

Query 2:
SELECT 100-ROUND (B. BYTES/ROUND (SUM (A. BYTES)/1024/1024, 2), 4) * 100 | '%' RATIOS
From v $ sgastat,
(Select pool, ROUND (SUM (BYTES)/1024/1024, 2) BYTES
From v $ SGASTAT
Where name = 'free memory 'and pool = 'shared pooled' group by pool) B
Where A. POOL = 'shared pooled 'group by B. BYTES, A. pool

The usage of the shared pool should be stable between 75% and 90%. If it is too small, it will be wasted. If it is too large, the memory is insufficient or the statement reusability is not high.

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.