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:

  1. 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".

  2. 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_TARGETvalues, 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 自动管理。










本文转自 客居天涯 51CTO博客,原文链接:http://blog.51cto.com/tiany/1361850,如需转载请自行联系原作者
相关实践学习
数据库实验室挑战任务-初级任务
本场景介绍如何开通属于你的免费云数据库,在RDS-MySQL中完成对学生成绩的详情查询,执行指定类型SQL。
阿里云云原生数据仓库AnalyticDB MySQL版 使用教程
云原生数据仓库AnalyticDB MySQL版是一种支持高并发低延时查询的新一代云原生数据仓库,高度兼容MySQL协议以及SQL:92、SQL:99、SQL:2003标准,可以对海量数据进行即时的多维分析透视和业务探索,快速构建企业云上数据仓库。 了解产品 https://www.aliyun.com/product/ApsaraDB/ads
目录
相关文章
|
24天前
|
存储 算法 编译器
【C++ 内存管理 重载new/delete 运算符 新特性】深入探索C++14 新的/删除的省略(new/delete elision)的原理与应用
【C++ 内存管理 重载new/delete 运算符 新特性】深入探索C++14 新的/删除的省略(new/delete elision)的原理与应用
42 0
|
4月前
|
存储 消息中间件 缓存
读Flink源码谈设计:有效管理内存之道
在最初接触到Flink时,是来自于业界里一些头部玩家的分享——大家会用其来处理海量数据。在这种场景下,`如何避免JVM GC带来StopTheWorld带来的副作用`这样的问题一直盘绕在我心头。直到用了Flink以后,阅读了相关的源码(以1.14.0为基准),终于有了一些答案。在这篇文章里也是会分享给大家。
541 1
|
4月前
|
Oracle 关系型数据库 数据库
使用docker安装配置oracle 11g
使用docker安装配置oracle 11g
|
6月前
|
Oracle 关系型数据库 数据库
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
Oracle 11G常见性能诊断报告(AWR/ADDM/ASH)收集
|
6月前
|
程序员 C语言 C++
动态内存管理函数的使用与优化技巧(内存函数、柔性数组)(下)
动态内存管理函数的使用与优化技巧(内存函数、柔性数组)(下)
24 0
|
6月前
|
程序员 编译器 C语言
动态内存管理函数的使用与优化技巧(内存函数、柔性数组)(上)
动态内存管理函数的使用与优化技巧(内存函数、柔性数组)(上)
32 0
|
6月前
|
Oracle 关系型数据库 数据库
9-4 Oracle管理表空间和数据文件
9-4 Oracle管理表空间和数据文件
|
1月前
|
存储 Oracle 关系型数据库
Oracle系列之七:表的创建与管理
Oracle系列之七:表的创建与管理
|
1月前
|
存储 Oracle 关系型数据库
手把手教你安装Oracle——以oracle 11g为例
手把手教你安装Oracle——以oracle 11g为例
手把手教你安装Oracle——以oracle 11g为例
|
1月前
|
存储 算法 Java
如何使用 Python 管理内存和避免内存泄漏?
如何使用 Python 管理内存和避免内存泄漏?
100 35

推荐镜像

更多