记录一次生产库遇到的4031错误,后来通过调整sga大小将问题解决了

报错信息:

ORA-04031: 无法分配 32 字节的共享内存 ("shared pool","select user#,password,datats...","SQLA","tmp")
Incident details in: /u01/app/oracle/diag/rdbms/twprod/xxxxx/incident/incdir_237848/xxxxx_ora_36005_i237848.trc
Use ADRCI or Support Workbench to package the incident.
See Note 411.1 at My Oracle Support for error and packaging details.
Tue Jun 06 19:57:24 2017
Errors in file /u01/app/oracle/diag/rdbms/xxxx/xxxx/trace/xxxx_e004_106234.trc (incident=238416):
ORA-04031: unable to allocate 32 bytes of shared memory ("shared pool","select /*+ INDEX(TAB AQ$_AQ...","SQLA","tmp")
Incident details in: /u01/app/oracle/diag/rdbms/xxxx/xxxx1/incident/incdir_238416/xxxx1_e004_106234_i238416.trc

查看当前sga设置:

SYS@ xxxx1> show parameter sga

NAME                                    TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                                 boolean      FALSE
pre_page_sga                        boolean      FALSE
sga_max_size                         big integer  20G
sga_target                              big integer  20G

调整sga为30g并重启数据库使参数生效:

SYS@ xxxx1> alter system set sga_max_size=30G scope=spfile;

SYS@ xxxx1> alter system set sga_target=30G scop=spfile;

SYS@ xxxx1> shutdown immediate

SYS@ xxxx1> startup

以下是Mos的解决方法,以供参考:

ORA-04031: Unable To Allocate 32 Bytes Of Shared Memory ("shared pool","select tablespace_id, rfno, ...","SQLA","tmp")" (文档 ID 1986741.1)

In this Document

APPLIES TO:

Oracle Database - Enterprise Edition - Version 11.2.0.2 and later

Information in this document applies to any platform.

SYMPTOMS

Alert log reports errors like below in almost all the instances:

ORA-04031: unable to allocate 32 bytes of shared memory ("shared pool","select tablespace_id, rfno, ...","SQLA","tmp")"

CAUSE

The trace file shows there are 6 sga subpools allocated.

...

****************** End of process map dump ************

==============================================

TOP 10 MEMORY USES FOR SGA HEAP SUB POOL 1

----------------------------------------------

"KGH: NO ACCESS " 4056 MB 61%

"gcs dynamic s " 713 MB 11%

"free memory " 625 MB 9%

"gcs dynamic r " 501 MB 8%

"init_heap_kfsg " 195 MB 3%

"FileOpenBlock " 122 MB 2%

"gcs resources " 64 MB 1%

"ges enqueues " 62 MB 1%

"gcs shadows " 45 MB 1%

"PRTMV " 40 MB 1%

-----------------------------------------

free memory 625 MB

memory alloc. 6031 MB

Sub total 6656 MB

==============================================

TOP 10 MEMORY USES FOR SGA HEAP SUB POOL 2

----------------------------------------------

"KGH: NO ACCESS " 3822 MB 71%

"free memory " 343 MB 6%

"SQLA " 223 MB 4%

"gcs dynamic r " 146 MB 3%

"KGLH0 " 126 MB 2%

"gcs dynamic s " 98 MB 2%

"gc name table " 96 MB 2%

"ges resource " 78 MB 1%

"PRTMV " 68 MB 1%

"gcs resources " 65 MB 1%

-----------------------------------------

free memory 343 MB

memory alloc. 5033 MB

Sub total 5376 MB

==============================================

TOP 10 MEMORY USES FOR SGA HEAP SUB POOL 3

----------------------------------------------

"KGH: NO ACCESS " 3812 MB 80%

"free memory " 215 MB 5%

"SQLA " 112 MB 2%

"KGLH0 " 97 MB 2%

"ges resource " 80 MB 2%

"gcs resources " 66 MB 1%

"gcs shadows " 46 MB 1%

"PRTMV " 45 MB 1%

"KQR X PO " 44 MB 1%

"ges enqueues " 22 MB 0%

-----------------------------------------

free memory 215 MB

memory alloc. 4521 MB

Sub total 4736 MB

==============================================

TOP 10 MEMORY USES FOR SGA HEAP SUB POOL 4

----------------------------------------------

"KGH: NO ACCESS " 3557 MB 79%

"free memory " 367 MB 8%

"KQR L PO " 79 MB 2%

"KGLH0 " 76 MB 2%

"gcs resources " 66 MB 1%

"SQLA " 61 MB 1%

"gcs shadows " 45 MB 1%

"PRTMV " 39 MB 1%

"ges enqueues " 16 MB 0%

"KGLHD " 12 MB 0%

-----------------------------------------

free memory 367 MB

memory alloc. 4113 MB

Sub total 4480 MB

==============================================

TOP 10 MEMORY USES FOR SGA HEAP SUB POOL 5

----------------------------------------------

"KGH: NO ACCESS " 3689 MB 85%

"free memory " 215 MB 5%

"KGLH0 " 74 MB 2%

"gcs resources " 65 MB 2%

"gcs shadows " 44 MB 1%

"PRTMV " 40 MB 1%

"SQLA " 32 MB 1%

"ges enqueues " 24 MB 1%

"db_block_hash_buckets " 21 MB 0%

"KGLHD " 12 MB 0%

-----------------------------------------

free memory 215 MB

memory alloc. 4137 MB

Sub total 4352 MB

==============================================

TOP 10 MEMORY USES FOR SGA HEAP SUB POOL 6

----------------------------------------------

"KGH: NO ACCESS " 3685 MB 76%

"free memory " 240 MB 5%

"gcs dynamic s " 138 MB 3%

"flashback generation buff " 122 MB 2%

"SQLA " 116 MB 2%

"gcs dynamic r " 106 MB 2%

"KGLH0 " 91 MB 2%

"gcs resources " 64 MB 1%

"gcs shadows " 44 MB 1%

"PRTMV " 41 MB 1%

-----------------------------------------

free memory 240 MB

memory alloc. 4624 MB

Sub total 4864 MB

TOTALS ---------------------------------------

Total free memory 2005 MB

Total memory alloc. 28 GB

Grand total 30 GB

==============================================

There are 6 subpools created in the SGA and a high amount of memory is allocated to "KGH: NO ACCESS "

There are multiple bugs open on the same but on 11gR2 there is no actual fix.

SOLUTION

As a solution for the issue you can disable the use of durations.

The shared pool can have subpools with 4 durations. These durations are "instance", "session", "cursor", and "execution". By default these durations are separate from each other.

The disable durations, you have to set the underscore parameter:

"_enable_shared_pool_durations = false"

This is recommended by development for all similar issues.

The main advantage of "_enable_shared_pool_durations = false" is that all the durations are combined into one pool and so a duration will not run out while another duration has free memory.

This issue will be fixed in 12c version due to architectural changes which will allow less need of durations for subpools.

Note:

Please note that unpublished Enhancement Request Bug 8857940 - NEED COMMON DURATIONS FOR UNSHRINKABLE POOLS 8857940, fixed starting with 12.1.0.1, addresses the durations issue as well. With the fix for Bug 8857940 in place, Oracle permits to group the shared pool durations in 2 groups to allow better shareability of the memory and avoid the ORA-4031 errors.

Another possible solution is to apply Patch 8857940 if it is available for your platform and version.

REFERENCES

BUG:19236833 - EXADATA: ORA-04031: UNABLE TO ALLOCATE 32 BYTES OF SHARED MEMORY "SQLA" "TMP"

NOTE:411.1 - ADR Different Methods to Create IPS Package

BUG:17789414 - SUPERCLUSTER: ORA-4031 ERRORS OCCURING WEEKLY CAUSING INSTANCE CRASHES

BUG:20447919 - ORA-4031: UNABLE TO ALLOCATE 32 BYTES

ORA-04031: Unable To Allocate 32 Bytes Of Shared Memory的更多相关文章

  1. [未解决:快速滑动collectionveiw请求数据崩溃]:unable to allocate 6553600 bytes for bitmap data

    崩溃:unable to allocate 6553600 bytes for bitmap data

  2. PHP错误——Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes)

    解释是可用内存已耗尽,这关系到PHP的memory_limit的设置问题. 这里有两种方法解决 1.修改php.ini memory_limit = 128 打开终端输入下列bash命令 cd /pr ...

  3. STM8程序在IAR中报错 unable to allocate space for sections

    Error[Lp011]: section placement failed: unable to allocate space for sections/blocks with a total es ...

  4. Could not allocate 40960 bytes percpu data

    2017-10-01 21:40:56[  176.700091] vif: Could not allocate 40960 bytes percpu data[  263.762812] perc ...

  5. linux 下tomcat出现 Native memory allocation (malloc) failed to allocate 1915224064 bytes for committing reserved memory问题

    ## There is insufficient memory for the Java Runtime Environment to continue.# Native memory allocat ...

  6. Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to allocate 64 bytes) in D

    Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to allocate 64 bytes) in D 从数据库 ...

  7. PHP运行错最有效解决办法Fatal error: Out of memory (allocated 786432) (tried to allocate 98304 bytes) in H:\freehost\zhengbao2\web\includes\lib_common.php on line 744

    原文 PHP运行错最有效解决办法Fatal error: Out of memory (allocated 6029312) Fatal error: Out of memory (allocated ...

  8. ms mpi error: unable to allocate launching block

    问题描述: 在VS 2015中使用Microsoft MPI(ms mpi)构建控制台应用,使用" mpiexec -n 4 myprog.exe"运行时退出并提示"un ...

  9. (转载)PHP的内存限制 Allowed memory size of 134217728 bytes exhausted (tried to allocate 1099 bytes) in

    (转载)http://blog.csdn.net/beyondlpf/article/details/7794028 Fatal error: Allowed memory size of 13421 ...

随机推荐

  1. rabbitMq创建和获取消息

    package com.yunda.inter.preload.contextinit; import net.sf.json.JSONObject; import org.apache.common ...

  2. 设计模式——工厂方法(Factory Method)

    定义一个用于创建对象的接口,让子类决定实例化哪一个类.工厂方法使一个类的实例化延迟到其子类. ——DP UML类图 模式说明 抽象业务基类 实际业务类的公共基类,也是工厂要创建的所有对象的父类,这部分 ...

  3. 【aspnetcore】配置使用jwt验证

    因为害怕token泄露出现问题,所以从未在项目中使用jwt.但这玩意现在真的很火,趁有空还是研究了一下. 在aspnetcore中实现jwt很简单,感觉微软把很多工作都做了,虽然开发效率上去了,但是使 ...

  4. URAL 1948 H - The Robot on the Line 二分 + 数学

    http://acm.hust.edu.cn/vjudge/contest/126149#problem/H 给定一条二次函数 f (x) = a * x * x + b * x + c 求一个最小的 ...

  5. iOS开发 - 3D Touch 应用系列一 - Quick Actions 创建桌面 Icon 快捷方式

    个言 很久没发随笔了,有一年多了吧.期间也曾想继续去写随笔,但是因为各种原因而耽搁了.最近又想了一下,还是有很多东西想要写,想要分享,想要记录下来的东西.之后我也会不断写随笔,但不止于 iOS 的方向 ...

  6. Retrofit2与RxJava用法大全

    Retrofit2是square公司出品的一个网络请求库,网上有很多相关的介绍.我很久以前都想去研究了,但一直都有各种事情耽搁,现在就让我们一起去捋一捋,这篇主要讲解Retrofit2与RxJava的 ...

  7. C#类型简述

    一.值类型 1.布尔类型 bool,范围 true false 2.整数类型 sbyte,范围 -128~127 byte,范围 0~255 short,范围 -32768~32767 ushort, ...

  8. 在ActionBar中,即便设置showAsAction="always",items仍然在overflow中显示的问题

    今天很是苦恼,明明设置了android:showAsAction="always",但是所有的items全部都显示在overflow中,然后在官网发现了答案. 如果你为了兼容 An ...

  9. 软件License设计

    如何保护软件版权,最常用的办法就是设计一套license验证框架. 1.我们的常规需求如下: .可以限制软件只能在一台机器上使用: 目前很多软件都是一机一码的销售,软件换一台机器则不能使用,想要几台机 ...

  10. centos6.5_64bit-nginx开机自启动

    Nginx 是一个很强大的高性能Web和反向代理服务器.下面介绍在linux下安装后,如何设置开机自启动. 首先,在linux系统的/etc/init.d/目录下创建nginx文件,使用如下命令:   ...