首页 技术 正文
技术 2022年11月10日
0 收藏 776 点赞 2,362 浏览 3303 个字

一,什么是内存粒度?

When a database instance starts up, the amount of memory allocated is determined by the allocations requested in the parameter file (init file or spfile).  This memory is allocated in units called granules. All memory pool sizes will be allocated in multiples of the granule size.

二,内存粒度大小定义

The granule size is determined based on the amount of memory requested at the instance startup. It is based on the SGA_MAX_SIZE.  If MEMORY_MAX_TARGET is specified, then SGA_MAX_SIZE defaults to MEMORY_MAX_TARGET for the purpose of sizing the granule.  Once set, the granule size does not change for the life of the instance.

The granule sizes at the time of writing, are:

三,内存粒度查询

You can check the granule size that is currently set for your database instance by running the following SQL statement as SYSDBA

— You can determine your granule size with this SQL 
SQL> select bytes from v$sgainfo where name like ‘Granule Size’;

There is a 16MB granule size maximum on 32-bit platforms. This applies even if the granule size is manually overridden.

四,内存粒度的重要性

The SGA memory components are sized as multiples of granules.
The components are:

  • shared pool
  • buffer cache (plus different size buffer caches)
  • redo log buffer
  • java pool
  • streams pool
  • large pool

There can be no component of size less than one granule. The minimum of some components can be greater than one granule (and rounded up to the nearest granule boundary).  For example the Buffer Cache minimum will be 4MB*num_cpus, and can exceed 1 granule.

If you set a value in the spfile that is not a multiple of the granule size, the actual size allocated will be rounded up to the nearest granule. This can become important in large SGA’s. 

For example, if your SGA in 11GR1 is 70G, and you set the java_pool_size to 150M in the spfile, the actual allocation for the java_pool_size will be rounded up to 512M.

The significance of this granule sizing is the following:

Consider a very large SGA on servers with many processors.
The SGA (actually shared, streams and large pool) gets divided in subpools, a maximum of 7 depending on the number of processors and the SGA size.
Typically, 16 processors (cores) will have 4 subpools, 24 processors will have 6 subpools, and 25 or more processors will have 7 subpools.  The number of subpools is derived by an internal algorithm.

In addition, in 10g and 11g, the shared pool and streams pool subpools are further divided into 4 ‘durations’ (“instance”, “session”, “cursor”, and “execution”).  
(It is possible the number of durations may change in 12g.)

So with over 24 processors, there would be 28 subpools in the shared pool and likely another 28 in the streams pool, each with a minimum of 1 granule.

If you add to that the granules for the other SGA pools, the memory usage could be over 60 granules even before any memory component exceeds 1 granule in size.

If the derived granule size is 256MB, the resulting memory requirement becomes over 15 GB just to start up the instance. This scenario can cause an ORA-4031 during or soon after startup.

Oracle Support can usually offer solutions to this by manually reducing the granule size or by reducing the processor count used in the subpool algorithm. 

The patch for unpublished Bug 8813366 reduces the granule sizing to help offset this error.

Another place where granule sizes are taken into consideration, is with Automatic Shared Memory Management (ASMM) in 10g, and Automatic Memory Management (AMM) in 11g.

As memory pressures rise on the Shared Pool, instead of a ORA-4031, the memory auto-tuner in ASMM (or AMM) will go to the Buffer Cache and transfer memory to the Shared Pool to fill the required need. This memory transfer is also done in granules. So with large SGA sizes, it is possible that a transfer of memory will not occur unless there is 256M or 512M of memory available to be transferred. If at least one granule is not available, an ORA-4031 will occur.

来自:NOTE:947152.1

来自为知笔记(Wiz)

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,565
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,413
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,186
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905