How much memory does each of the individual components of the SGA need? Oracle now has methods to determine most of the major parameters all on its own.

What is the SGA

Simply stated, the system global area (SGA) is just shared memory structures that are created at instance startup, hold information about the instance and control its behavior. The following table gives a brief synopsis of the particular components of the SGA, the variables that control the size of memory allocated, some of the areas of the Oracle server the particular component has an influence on, and then a very brief description. What can be seen from this simple list is that there are plenty of options available for us to tweak the SGA and without a complete understanding of what our applications are doing in the background, our ability to guess the appropriate amount of memory to give each of these individual components is not always optimal. What we do not want to have happen in this process of allocation of memory is to waste it.

Components of the SGA

SGACOMPONENT SIZE CONTROLED BY AREAS OF INFLUENCE

SIMPLE DESCRIPTONS

Shared Pool SHARED_POOL_SIZE Library Cache

  • Shared SQL areas
  • Private SQL areas
  • PL/SQL procedures and packages
  • Various control structures

Oracle needs to allocate & deallocate memory as SQL or procedural code is executed based on the individual needs of users' sessions and in accordance to the LRU algorithm.

Dictionary Cache

  • Row cache
  • Library cache

Highly accessed memory structures that provide information on object structures to SQL statements being parsed.

Java Pool JAVA_POOL_SIZE
  • Run state
  • Methods
  • Classes
  • Session code
  • Data in JVM

Memory available for the Java memory manager to use for all things Java.

Streams Pool STREAMS_POOL_SIZE
  • Stream activity

New to Oracle 10g, memory available for stream processing.

Redo Log Buffer LOG_BUFFER
  • Redo entries

Holds changes made to data and allows for the reconstruction of data in the case of failure.

Database Buffer Cache

DB_2K_CACHE_SIZE

DB_4K_CACHE_SIZE

DB_8K_CACHE_SIZE

DB_16K_CACHE_SIZE

DB_32K_CACHE_SIZE

DB_KEEP_CACHE_SIZE

DB_RECYCLE_CACHE_SIZE

  • Write list
  • LRU list

Holds copies of data requested by SQL and reduces requests to disk by having data in memory. You may have many different buffer caches that help segregate on usage patterns.

Large Pool LARGE_POOL_SIZE
  • Shared server
  • Oracle XA
  • I/O server processes
  • Backup & restore

For large memory allocations.

You can look at the size of your SGA by looking at the initialization parameters that control its size. Here is a simple query and its output.

select name, value
from v$parameter
where name in ('shared_pool_size', 'java_pool_size', 'streams_pool_size',
'log_buffer', 'db_cache_size', 'db_2k_cache_size', 'db_4k_cache_size',
'db_8k_cache_size', 'db_16k_cache_size', 'db_32k_cache_size',
'db_keep_cache_size', 'db_recycle_cache_size', 'large_pool_size');
NAME VALUE
------------------------- ---------
shared_pool_size 83886080
large_pool_size 8388608
java_pool_size 50331648
streams_pool_size 54525952
db_cache_size 25165824
db_2k_cache_size 0
db_4k_cache_size 0
db_8k_cache_size 0
db_16k_cache_size 0
db_32k_cache_size 0
db_keep_cache_size 0
db_recycle_cache_size 0
log_buffer 262144 13 rows selected.
 
 

Letting Oracle Take Control

Using Oracle's Automatic Shared Memory Tuning, you can instruct Oracle to manage a subset of the components that make up the SGA by merely telling the instance the target size of the SGA through the new SGA_TARGET parameter. Oracle will then pool from this value and dynamically distribute memory across selected components of the SGA. You now need not set values for SHARED_POOL_SIZE, JAVA_POOL_SIZE, LARGE_POOL_SIZE, or DB_CACHE_SIZE as Oracle will automatically size them for you. Once you set the SGA_TARGET parameter to a desirable size for your SGA these parameters will take on a value of zero and new parameters will be created designated by __SHARED_POOL_SIZE, __JAVA_POOL_SIZE, LARGE_POOL_SIZE, and __DB_CACHE_SIZE. As workloads go through the system and memory is needed in these areas, Oracle will allocate more memory based on internal statistics trends. Oracle will not manage the DB_KEEP_CACHE_SIZE, DB_RECYCLE_CACHE_SIZE, DBnK_CACHE_SIZE, or the STREAMS_POOL_SIZE and you must still determine the value for these parameters. In order for this all to take place, you must be using an SPFILE as this is the only way Oracle can dynamically make all these changes happen. Also, note that SGA_TARGET is the sum of all parameters that make up the SGA, not just the parameters it controls, so you must take those components it does not control into consideration when you give a value for SGA_TARGET.

Stepping through Letting Oracle Take Control

There is really nothing to switching into automatic shared memory tuning. You only need to set the SGA_TARGET parameter.

1. Take a look and see if you are already in automated sizing of SGA

SQL> show parameter sga_target
NAME TYPE VALUE
------------------------------------ ----------- --------
sga_target big integer 0

2. Alter system to begin automated sizing of SGA

SQL> alter system set sga_target=216m;
System altered.

3. Done

What happens when you switch to Automatic Shared Memory Tuning is a bit interesting. After you alter SGA_TARGET parameter, your SPFILE will undergo a change and now have the following parameters defined. Note that k101 is my instance name and will take on whatever the instance name is.

k101.__db_cache_size=25165824
k101.__java_pool_size=50331648
k101.__large_pool_size=8388608
k101.__shared_pool_size=83886080

In addition, when you issue the previously given SQL to show the parameter settings for the individual components of the SGA you will notice that they now have a value of zero.

select name, value
from v$parameter
where name in ('shared_pool_size', 'java_pool_size', 'streams_pool_size',
'log_buffer', 'db_cache_size', 'db_2k_cache_size', 'db_4k_cache_size',
'db_8k_cache_size', 'db_16k_cache_size', 'db_32k_cache_size',
'db_keep_cache_size', 'db_recycle_cache_size', 'large_pool_size');
NAME VALUE
------------------------- ---------
shared_pool_size 0
large_pool_size 0
java_pool_size 0
streams_pool_size 0
db_cache_size 0
db_2k_cache_size 0
db_4k_cache_size 0
db_8k_cache_size 0
db_16k_cache_size 0
db_32k_cache_size 0
db_keep_cache_size 0
db_recycle_cache_size 0
log_buffer 262144
13 rows selected.

If you truly want to see the parameters after setting the SGA_TARGET you will need to modify the query to include the newly created underscore variables. This can be of some concern if you are relying on the "normal" parameters for any database monitoring scripts.

select name, value
from v$parameter
where name in ('__shared_pool_size', '__java_pool_size',
'streams_pool_size', 'log_buffer', '__db_cache_size', 'db_2k_cache_size',
'db_4k_cache_size', 'db_8k_cache_size', 'db_16k_cache_size',
'db_32k_cache_size', 'db_keep_cache_size', 'db_recycle_cache_size',
'__large_pool_size'); NAME VALUE
------------------------- ---------
__shared_pool_size 67108864
__large_pool_size 4194304
__java_pool_size 8388608
streams_pool_size 0
__db_cache_size 142606336
db_2k_cache_size 0
db_4k_cache_size 0
db_8k_cache_size 0
db_16k_cache_size 0
db_32k_cache_size 0
db_keep_cache_size 0
db_recycle_cache_size 0
log_buffer 262144 13 rows selected.

Switching over to the Automatic Shared Memory Tuning is as easy as setting an initialization parameter. How this will behave under load is yet to be determined but since these numbers are driven by the various advisories and I am mostly happy with them as individual components, I see no reason not to venture down the path of having Oracle automatically size my SGA. Of course, as always, in a test environment first. I would suggest you take a snapshot of your initialization parameters before letting Oracle take control and then compare the end settings that Oracle has implemented. It is always easy to switch back, just reset the SGA_TARGET parameter and set the individual components back to their original values.

Automate the Sizing of your SGA in Oracle 10g的更多相关文章

  1. oracle 10g升级到11g

    Linux 上Oracle RAC 10g 升级到 Oracle RAC 11g 了解如何在 Oracle Enterprise Linux 5 上逐步将 Oracle RAC 10g 第 2 版升级 ...

  2. [转]oracle性能调优之--Oracle 10g AWR 配置

    一.ASH和AWR的故事 1.1 关于ASH 我们都知道,用户在ORACLE数据库中执行操作时,必然要创建相应的连接和会话,其中,所有当前的会话信息都保存在动态性能视图V$SESSION中,通过该视图 ...

  3. Install Oracle 10g on Red Hat Linux 5.3 Step by Step

    一.虚拟机配置 1. 虚拟机(VBox 4.3.12) 2. 配置虚拟机网卡网络.选择host-only.VirtualBox Host-Only Network网卡IP为设置为192.168.1.1 ...

  4. Oracle 10g R2 Transparent Data Encryption 透明数据加密

    Oracle 10g R2 Transparent Data Encryption 透明数据加密 本章介绍如何使用透明数据加密来保护Oracle数据库中的敏感数据,该功能使您可以加密数据库列并管理加密 ...

  5. [转帖]达梦数据库(DM6)和ORACLE 10g的异同点

    达梦数据库(DM6)和ORACLE 10g的异同点    https://bbs.aliyun.com/detail/351337.html   花花浪子 级别: 小白 发帖 0 云币 -41 加关注 ...

  6. 安装Oracle 10g

    本文仅用于学习交流,商业用途请支持正版!转载请注明: http://www.cnblogs.com/mxbs/p/6217052.html 准备: Oracle 10g for Win(32-Bit) ...

  7. Oracle 10g安全加固(审计、监听密码)

    环境: Linux 6.4 + Oracle 10.2.0.4 1. Oracle 10g 审计功能 2. 对数据库监听器的关闭和启动设置密码 1. Oracle 10g 审计功能 Oracle 10 ...

  8. ORACLE 10g 数据库体系结构图

    ORACLE 10g 的数据库体系结构图(ORACLE 10g(Release 2)ARCHITECTURE),非常的全面.系统.高屋建瓴的整体介绍了ORACLE 10g 的数据库体系结构.如果能全面 ...

  9. RHEL6 64位系统安装ORACLE 10g 64bit 数据库

    记得去年4月份的时候,为公司部署测试环境和UAT环境时,在红帽RHEL6 64位系统安装ORACLE 10g 64位数据库时遇到了许多小问题,当时匆匆忙忙也没记录一下这些问题,前几天在虚拟机安装ORA ...

随机推荐

  1. 科学经得起实践检验-python3.6通过决策树实战精准准确预测今日大盘走势(含代码)

    科学经得起实践检验-python3.6通过决策树实战精准准确预测今日大盘走势(含代码) 春有百花秋有月,夏有凉风冬有雪: 若无闲事挂心头,便是人间好时节. --宋.无门慧开 不废话了,以下训练模型数据 ...

  2. 常用chrome插件&&常用FireFox插件

    第一部分:chrome插件 chrome中输入  chrome://chrome-urls/   可以得到包括缓存在内的很多相关信息. 1.掘金chrome插件 点击下载 掘金是一个高质量的互联网技术 ...

  3. Javac语法糖之内部类

    在Javac中解语法糖主要是Lower类来完成,调用这个类的入口函数translateTopLevelClass即可.这个方法只是JavacCompiler类的desugar方法中进行了调用. 首先来 ...

  4. 《垃圾回收的算法与实现》——GC标记-清除算法

    基本算法 标记-清除算法由 ==标记阶段== 和 ==清除阶段== 构成. 标记即将所有活动的对象打上标记. 清除即将那些没有标记的对象进行回收. 标记与清除 遍历GC root引用,递归标记(设置对 ...

  5. mysql show processlist分析

    mysql> show processlist; +—–+————-+——————–+ | Id | User | Host | db | Command | Time| State | Inf ...

  6. Linux笔记:linux常用命令

    文件目录操作 1.展示目录命令 ls # 展示当前目录下的可见文件 ls -a # 展示当前目录下所有的文件(包括隐藏的文件) ls -l # 展示当前目录下文件的详细信息 ll # 展示当前目录下文 ...

  7. hadoop的RPC机制 -源码分析

    这些天一直奔波于长沙和武汉之间,忙着腾讯的笔试.面试,以至于对hadoop RPC(Remote Procedure Call Protocol ,远程过程调用协议,它是一种通过网络从远程计算机程序上 ...

  8. 为 Nginx 创建 windows 服务自启动

    1.下载最新版的 Windows Service Wrapper 程序 下载地址:http://download.java.net/maven/2/com/sun/winsw/winsw/1.9/ 2 ...

  9. hadoop学习笔记(八):MapReduce

    一.MapReduce编程模型 一种分布式计算框架,解决海量数据的计算问题. MapReduce将整个并行计算过程抽象到两个函数: Map(映射):对一些独立元素组成的列表的每一个元素进行制定的操作, ...

  10. Android 控件:使用下拉列表框--Spinner

    ---恢复内容开始--- 一.前段代码 <Spinner android:id="@+id/spin" android:paddingTop="10px" ...