首页 > Linux操作系统 > Linux操作系统 > Automatic Memory Management

Automatic Memory Management

原创 Linux操作系统 作者:ygzhou518 时间:2012-03-27 17:34:11 0 删除 编辑

Automatic Memory Management

Oracle's Automated Memory Management (AMM) features were significantly enhanced in Oracle 11g. With AMM a database can automatically manage both the system global area (SGA) and the program global area (PGA). To support this new feature Oracle 11g added two new parameters, memory_target and memory_max_target. In support of these new features Oracle also added functionality to the database Advisor framework as well as new views.

Overview of Automatic Memory Management

All of the methods of managing memory from previous versions of the Oracle database are still available for use in Oracle 11g. Therefore Oracle 11g is fully backwards compatible, and when you upgrade your database you will not need to rush to configure AMM. AMM was added onto the existing Oracle Automated Memory Management structure, making it easy to use. As with previous parameters such as sga_target, the Oracle 11g AMM allows for the use of the various parameter settings that can be used to configure minimum settings for the pools that the parameters are associated with. As a result, you can still indicate that a minimum amount of memory should be allocated to the database buffer cache for example. Supporting the new AMM achitecture are two new memory parameters, memory_max_target and memory_target. The relationship of the various memory parameters is illustrated in the figure below.

Relationship of Memory Parameters

The Memory_Target Parameter

The memory_target parameter combines the pre-Oracle 11g sga_target parameter value with the pga_aggregate_target parameter. Thus, memory_target represents the total amount of memory that Oracle has available to allocate between the various SGA and PGA structures. The memory_target parameter is a dynamic parameter and can be changed up to and including the value of memory_max_target.

The Memory_Max_Target Parameter

The memory_max_target parameter is much like the sga_max_size parameter available in Oracle 10g. Memory_max_target provides for a maximum size that you can dynamically increase memory_target to. Therefore, within the constraints of memory_max_target, you can easily adjust the overall memory allocated to the database at any given time, dynamically. One down side to setting the memory_max_target parameter to a value higher than memory_target is that on most operating system platforms, Oracle will still reserve unto itself an amount of memory equivalent to memory_max_target. Thus, the memory will not be available on the server for other non-Oracle processes to use, and in fact other Oracle databases on that server will not have access to that memory. So, set memory_max_target with caution.

Oracle will always configure the memory_max_target parameter if it is not set manually with a derived value. This derived value is set to a value equal to the value of the memory_target parameter. Oracle will set memory_max_target to a value of 0 if memory_target is not set. If memory_target is not set and memory_max_target is set to a value greater than zero, then you can modify memory settings dynamically by changing memory_target, or by dynamically altering the other specific memory parameter settings. The figure below illustrates the auto memory parameter dependency.

Auto Memory Parameter Dependency

MMT = Memory Max Target
MT = Memory Target
ST = SGA Target
PAT = PGA Aggregate Target
SMS = SGA Max Size

When you upgrade your Oracle Database to Oracle 11g you can configure the memory_target parameter during the upgrade, or you can choose to do it later. Regardless, when you do configure memory_target the best way to initially determine what value to set it to would be to sum up the sizes of sga_target and pga_aggregate_target. The sum of these two values should give you a good guideline as to what to set the memory_target parameter too. After configuring memory_target, you can set sga_target and pga_aggregate_target to zero values.

When configuring your new memory settings you can still choose to leave the sga_target and pga_aggregate_target parameters set to their current values. If you leave these parameters set (or subsequently configure them) you indicate minimum amounts of memory that should be allocated to these structures. This implies that if you configure memory_target during the upgrade process, leaving sga_target and pga_aggregate_target set as configured, then memory_target >= (sga_target + pga_aggregate_target). If memory_target < (sga_target + pga_aggregate_target) the instance will fail to start returning an ORA-00838 error.

There are some other issues to be aware of when using AMM. First the memory_target and memory_max_target parameters cannot be used when LOCK_SGA has been set. Also memory_target and memory_max_target cannot be used in conjunction with huge pages on Linux. Additionally, some platforms can give you trouble about setting memory_target. For example, on Linux you need to make sure that /dev/shm (or it's equivalent) is allocated with an amount of space slightly larger than what you wish to set the memory_target value too. Failure to do this will result in the following error:

ORA-00845: MEMORY_TARGET not supported on this system

Also, be careful when changing settings if you are converting to automated memory management. You will want to make sure that the sga_max_size and sga_size are not set when converting to memory_max_target and memory_target. While setting these parameters at the same time is supported, you need to do so carefully so as to avoid unexpected consequences.

The bottom line is that you need to carefully review the Oracle 11g documentation specific to your Operating System and determine not only the impacts of running specific features on your OS, but how to properly configure your OS to use those features.

Configuring AMM

Moving to AMM can be done manually or you can use OEM. The Oracle Database Configuration Assistant (DBCA) also provides the ability to configure new databases with AMM. As is true anytime you start using a new feature, do so carefully. As with anything else new, convert to AMM with caution, testing changes in your development, test and quality assurance environments. With regard to new databases built on the 11g stack (and specifically those designed for new development projects), configure them to use AMM from the beginning. Just be aware while you are developing systems that you are using AMM and that there is a possibility that you could run into bugs using this newer feature.

来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量