ora-04301 Fault Handling in Oracle

Source: Internet
Author: User

The last time the database was reported ora-04301, the shared pool size was adjusted a little bit, and recently this error has occurred. So determined to make a good application, mainly the debris is too serious ah.

The code is as follows Copy Code


Select Ksmchidx,
(case
When Ksmchsiz >= 65560 then
254
When Ksmchsiz >= 32792 then
253
When Ksmchsiz >= Then
1
When Ksmchsiz >= Then
0
End) bucket#,
COUNT (*) Free_chunks,
SUM (ksmchsiz) free_space,
Trunc (avg (ksmchsiz)) avg_chunk_size
From X$ksmsp
where ksmchcls = ' free '
Group BY KSMCHIDX,
(case
When Ksmchsiz >= 65560 then
254
When Ksmchsiz >= 32792 then
253
When Ksmchsiz >= Then
1
When Ksmchsiz >= Then
0
End);

This is the SQL that observes the shared pool fragmentation situation.

The code is as follows Copy Code

Select Name,value from V$sysstat where name like '%parse% ';

See the resolution, a lot of hard parsing, and soft parsing is not good!

The code is as follows Copy Code



SELECT substr (Sql_text, 1,) "SQL", count (*), SUM (executions) "Totexecs", Max (sql_id) sql_id
From V$sqlarea
WHERE Executions < 5
GROUP by substr (Sql_text, 1, 40)
Having count (*) > 30
Order by 2;

SELECT * from V$sqlarea where sql_id= ' g2b789ppwxjx8 ';

Check for SQL that consumes more shared pool.

The code is as follows Copy Code

Elect Ksmchcls CLASS, COUNT (ksmchcls) NUM, SUM (ksmchsiz) siz,
To_char ((SUM (Ksmchsiz)/count (KSMCHCLS)/1024), ' 999,999.00 ') | | K ' "AVG SIZE"
From X$ksmsp GROUP by KSMCHCLS;

Shared pool situation.

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.