设为首页 收藏本站
查看: 1395|回复: 0

[经验分享] ORACLE 11g 自动内存管理(原创)

[复制链接]

尚未签到

发表于 2016-7-22 09:26:44 | 显示全部楼层 |阅读模式
  Overview
  在oracle 11g中,使用一个参数memory_target就能够实现SGA和PGA组件依据工作负荷进行自动内存分配。oracle推荐使用自动内存管理简化内存分配。
oracle 11g依然支持手工内存分配:
1:oracle 11g使用memory_target来支持内存自动分配。
2:使用sga_target和pga_target参数来设置SGA和PGA,数据库会在这两个组件中自我优化。
3:你也可以手工设置SGA中的各个组件。比如db_cache_size,shared_pool_size等组件。
oracle 11g中新的内存初始化参数:
有两个新的关键的内存初始化参数memory_target(动态参数,设置分配给实例的内存数)和memory_max_size(静态参数,这个参数是可选的,设置实例能够分配的最大内存,设置的是memory_target的上限值)。
  注意:虽然memory_target是一个动态参数,但是当数据库运行时,你不能从非自动内存管理交换到自动内存管理。必须重启数据库将参数应用到实例启动过程才行。
  When you upgrade to Oracle Database 11g using the DBUA (Database Upgrade Assistant), by default, the memory_target parameter is set to zero, meaning automatic memory management is disabled by default. However, when you create a new database using the DBCA (Database Creation Assistant), you can specify automatic memory management. You specify your choice in the Initialization Parameters page by clicking the Memory tab on that page. Following are two options offered on that page:

  • The Typical option lets you configure memory for a new database with minimal input and is ideal for most environments. Just enter a value in the Memory Size field and check the Use Automatic Memory Management option in the Typical section of the page to institute automatic memory management for the new database.
  • The Custom option provides you more control over the allocation of memory to the database. You can select the Automatic option to allocate specific amounts of memory to the SGA and PGA components of database memory. You can select the Manual option to set specific memory allocations for SGA subcomponents such as the buffer pool and the shared pool.
  参数配置策略
MEMORY_TARGET 设置为非零值时:

  • If you also set the sga_target and the pga_aggregate_target parameters, the database will consider them the minimum values for the SGA and PGA allocations of memory. The memory_target parameter can take a value anywhere between the sum of SGA and PGA to the high value set by the memory_max_target parameter.
  • 如果设置了 SGA_TARGET 但未设置PGA_AGGREGATE_TARGET,则仍会自动优化这两个参数。PGA_AGGREGATE_TARGET 将初始化为以下值:(MEMORY_TARGET -SGA_TARGET)。
  • 如 果设置了 PGA_AGGREGATE_TARGET 但未设置 SGA_TARGET,则仍会自动优化这两个参数。SGA_TARGET 将初始化为值 min(MEMORY_TARGET -PGA_AGGREGATE_TARGET, SGA_MAX_SIZE(如果用户已设置)),系统将自动优化子组件。
  • 如果未设置任何参数,则无需最小值或默认值即可自动优化这两个参数。 有这样一个策略:在初始化过程中,将服务器的总内存按固定比率分配给SGA 和 PGA。该策略将在启动时分配 60% 的内存给SGA,40% 的内存给 PGA。
  • If you set the memory_target parameter in the initialization parameter file but leave out the memory_max_size parameter, the database sets the memory_max_size parameter’s value to that of the memory_target_size parameter.
  
  如果未设置 MEMORY_TARGET,或者将其显式设置为 0(11g 中的默认值为 0)时:

  • If you set neither the pga_aggregate_target nor the sga_target parameters, SGA is not automatically tuned, but the PGA is.
  • If only the sga_target parameter is set, the database automatically tunes only the subcomponents of the SGA. PGA is auto-tuned whether you set it or not.
  • If you set the memory_max_target parameter in an initialization parameter file (init.ora) but not the memory_target parameter, the database will set the memory_target parameter’s size to its default value of zero. That is,automatic memory management will be disabled.
  Monitoring Automatic Memory Management
  Use the V$MEMORY_DYNAMIC_COMPONENTS view to monitor the current sizes of all dynamically tuned memory components, as shown here:
  SQL> select component, current_size, user_specified_size
   2  from v$memory_dynamic_components
   3* where current_size!=0;
COMPONENT              CURRENT_SIZE      USER_SPECIFIED_SIZE
-------------------    --------------    -------------------
shared pool            109051904         0
large pool             4194304           0
java pool              12582912          0
SGA Target             134217728         0
DEFAULT buffer cache   4194304           0
PGA Target             130023424         0
6 rows selected.
As you can see, the query also shows the current total size of the SGA and the PGA components. The V$MEMORY_RESIZE_OPS view contains a circular buffer of the 800 most recent completed memory resizing operations. You can find the current memory resize operations that are in progress by querying the V$MEMORY_ CURRENT_RESIZE_OPS view.
  ORA-00845
  SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
这是因为/dev/shm没有设置正确的值,确保这个值至少等于sga_max_size参数值。
[oracle@node1 dbs]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       14G  9.4G  3.2G  75% /
/dev/sda1              99M   14M   81M  15% /boot
none                  2.0G  702M  1.4G  35% /dev/shm
可以看到该值为2G。
可以通过/etc/fstab来更改该值:
默认情况下该文件相关内容如下:
[oracle@node1 dbs]$ cat /etc/fstab |grep shm
none                    /dev/shm                tmpfs   defaults       0 0
可以将该值修改为如下:
none                    /dev/shm                tmpfs   defaults,size=2G        0 0
然后重启系统即可解决问题。
  
  参考至:《McGraw.Hill.OCP.Oracle.Database.11g.New.Features.for.Administrators.Exam.Guide.Apr.2008》http://blog.iyunv.com/uid-16728139-id-3172139.html
  本文原创,转载请注明出处、作者
  如有错误,欢迎指正
  邮箱:czmcj@163.com

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-247651-1-1.html 上篇帖子: 【转】Oracle TM锁 TX锁 下篇帖子: oracle union联合查询排序方式
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表