Oracle 11g 新特性之---Oracle 内存自动管理
Oracle 11g 新特性之---- Oracle 内存自动管理
Oracle 11g 以后,Oracle 实现了对内存的自动管理,减轻了DBA管理的工作量,以下是Oracle官方对内存管理的解释:
Oracle have made great strides in simplifying memory management over the last few versions of the database. Oracle 9i automated PGA management by introducing PGA_AGGREGATE_TARGETparameter. Oracle 10g continued this trend by automating SGA management using theSGA_TARGET parameter. Oracle 11g takes this one step further by allowing you to allocate one chunk of memory, which Oracle uses to dynamically manage both the SGA and PGA.
At the time of writing, Automatic Memory Management (AMM) is only supported on the major platforms (Linux, Solaris, Windows, HP-UX, AIX).
AMM Parameters
Automatic memory management is configured using two new initialization parameters:
MEMORY_TARGET: The amount of shared memory available for Oracle to use when dynamically controlling the SGA and PGA. This parameter is dynamic, so the total amount of memory available to Oracle can be increased or decreased, provided it does not exceed theMEMORY_MAX_TARGET limit. The default value is "0".
MEMORY_MAX_TARGET: This defines the maximum size the MEMORY_TARGET can be increased to without an instance restart. If the MEMORY_MAX_TARGET is not specified, it defaults toMEMORY_TARGET setting.
When using automatic memory management, the SGA_TARGET and PGA_AGGREGATE_TARGET act as minimum size settings for their respective memory areas. To allow Oracle to take full control of the memory management, these parameters should be set to zero.
If you are using UNIX/Linux, before you consider using AMM you should check the current size of your shared memory file system. On Linux you do this by issuing the following command.
# df -k /dev/shm Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 1029884 350916 678968 35% /dev/shm #
The shared memory file system should be big enough to accommodate the MEMORY_TARGET andMEMORY_MAX_TARGET values, or Oracle will throw the following error.
ORA-00845: MEMORY_TARGET not supported on this system
To adjust the shared memory file system size issue the following commands, specifying the required size of shared memory.
# umount tmpfs # mount -t tmpfs shmfs -o size=1200m /dev/shm
Make the setting permanent by amending the "tmpfs" setting of the "/etc/fstab" file to look like this.
tmpfs /dev/shm tmpfs size=1200m 0 0
Oracle内存自动管理的配置:
一般来说,ORACLE实例内存=物理内存*80%
OLTP系统:
PGA=实例内存*20%
SGA=实例内存*80%
OLAP系统:
PGA=实例内存*50%
SGA=实例内存*50%
混合型系统在二者之间
Oracle 应用之OLTP 和 OLAP:
OLTP与OLAP区别:
OLTP即联机事务处理,就是我们经常说的关系数据库,意即记录即时的增、删、改、查,要求实时处理、支持并发。程序员开发,企业应用基本是此类数据库。
OLAP即联机分析处理,是数据仓库的核心部心,所谓数据仓库是对于大量已经由OLTP形成的数据的一种分析型的数据库,用于处理商业智能、决策支持等重要的决策信息;
数据仓库是在数据库应用到一定程序之后而对历史数据的加工与分析。对数据的实时性、精确性要求不高,数据主要用于提供绐决策层作决策的依据。
确定内存容量后,对于PGA:使用WORKAREA_SIZE_POLICY设置为AUTO,表示PGA自动管理
用PGA_AGREGGATE_TARGET参数分配PGA
用SGA_TARGET参数分配SGA目标值
用SGA_MAX_SIZE分配SGA最大值
假设物理内存为4g的OLTP系统
设置PGA_AGGREGATE_TARGET和SGA_TARGET,表示分别启动PGA和SGA自动内存管理
sqlplus中配置参数
sql>alter system set WORKAREA_SIZE_POLICY=auto scope=spfile
sql>alter system set PGA_AGGREGATE_TARGET=655M scope=spfile
在用新的自动内存管理特性给数据库分配适当的尺寸之前,必须首先查找当前有多少内存分配给了SGA和PGA。但是并不意味简单的将sga_target和pga_target参数求和相加的内存需求。原因是:与sga_target参数不同,数据库不立即接管分配给pga_target参数的内存。数据库只根据pga_target参数设置将PGA分配给每个部分,因此,你的pga_target也许分配得很大,但是数据库在给定时间内却只是用了很小的一部分。
查询数据库内存信息:
SQL> show parameter memory
SQL> show parameter sga_max_size;
SQL> show parameter SGA_TARGET;
SGA_TARGET是oracle10g中用于实现自动SGA内存管理而新增加的。是可动态调整的,但其值不能大于sga_max_size。
通过ASMM可以实现对share pool、buffer cache、large pool、java pool、stream pool的自动管理
当使用sga_target时, 若未设置sga_max_size,或设置了小于sga_target,则sga_max_size将等于sga_target。
sql>alter system set SGA_TARGET=2620M scope=spfile
sql>alter system set SGA_MAX_SIZE=2620M scope=spfile
重启实例后生效。
注:
如果启用了内存的自动管理,可以不用设置SGA_TARGET 和 PGA_AGGREGATE_TARGET 参数,由Oracle 自动管理。
本文出自 “天涯客的blog” 博客,请务必保留此出处http://tiany.blog.51cto.com/513694/1361850
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。