11g自动内存设置-整理自官方文档

The simplest way to manage instance memory is to allow the Oracle Database instance to automatically manage and tune it for you.

一种简单管理内存的方式是:让oracle自动为你管理和调优!

 To do so (on most platforms), you set only a target memory size initialization parameter (MEMORY_TARGET) and optionally a maximum memory size initialization parameter (MEMORY_MAX_TARGET).

多数平台上,你只需设置初始化参数MEMORY_TARGET,再随意(大于后者等于MEMORY_TARGET)设置初始化参数MEMORY_MAX_TARGET

 The total memory that the instance uses remains relatively constant, based on the value of MEMORY_TARGET, and the instance automatically distributes memory between the system global area (SGA) and the instance program global area (instance PGA). As memory requirements change, the instance dynamically redistributes memory between the SGA and instance PGA.

实例的总内存以MEMORY_TARGET设置的值为准(开机时oracle以MEMORY_TARGET参数值为准给instance分配内存!如果业务需要分配更大内存,oracle将自动扩展,但不能超过MEMORY_MAX_TARGET的值),实例根据需要自动分配内存给SGA和PGA

When automatic memory management is not enabled, you must size both the SGA and instance PGA manually.

当自动内存管理未启用时,你必须指定SGA和PGA的内存大小

Because the MEMORY_TARGET initialization parameter is dynamic, you can change MEMORY_TARGET at any time without restarting the database.

MEMORY_TARGET 是一个动态参数,可以再任何需要的时候进行调整而不必重启实例!

MEMORY_MAX_TARGET, which is not dynamic, serves as an upper limit so that you cannot accidentally set MEMORY_TARGET too high, and so that enough memory is set aside for the database instance in case you do want to increase total instance memory in the future. Because certain SGA components either cannot easily shrink or must remain at a minimum size, the instance also prevents you from setting MEMORY_TARGET too low.

MEMORY_MAX_TARGET是一个静态参数,作为一个上限值(限制MEMORY_TARGET参数),你不能将MEMORY_TARGET设置的过高,并且要保留足够的内存来满足在以后实例的扩张。但是实例总是不允许你将MEMORY_TARGET参数设置的过低,因为SGA的组件大小有最小值限定,还有些组件是很难缩小的!

If you create your database with Database Configuration Assistant (DBCA) and choose the basic installation option, automatic memory management is enabled. If you choose advanced installation, Database Configuration Assistant (DBCA) enables you to select automatic memory management.

如果你用DBCA创建数据库并且选择基本安装选项,自动内存默认是启用的!假如你是高级安装你也可以选择启用自动内存管理!

 开启自动内存管理的步骤:

1:Start SQL*Plus and connect to the database as SYSDBA.

以sys用户登录

2:Calculate the minimum value for MEMORY_TARGET as follows:

计算MEMORY_TARGET 的最小值!

a:Determine the current sizes of SGA_TARGET and PGA_AGGREGATE_TARGET by entering the following SQL*Plus command:

确定SGA_TARGET ,PGA_AGGREGATE_TARGET 参数的大小:

show parameter target

NAME                          TYPE        VALUE
------------------------------ ----------- ----------------
archive_lag_target             integer     0
db_flashback_retention_target  integer     1440
fast_start_io_target           integer     0
fast_start_mttr_target         integer     0
memory_max_target              big integer 0
memory_target                  big integer 0
pga_aggregate_target           big integer 90M
sga_target                     big integer 272M

b:Run the following query to determine the maximum instance PGA allocated since the database was started:Run the following query to determine the maximum instance PGA allocated since the database was started:

确定从数据库启动以来实例分配给PGAde 的最大值:

 select value/1024/1024||'m' from v$pgastat where name='maximum PGA allocated';

c:Compute the maximum value between the query result from step 2b and PGA_AGGREGATE_TARGET. Add SGA_TARGET to this value.

计算memory_target 最大值

  • memory_target = sga_target + max(pga_aggregate_target, maximum PGA allocated)
    
    For example, if SGA_TARGET is 272M and PGA_AGGREGATE_TARGET is 90M as shown above, and if the maximum PGA allocated is determined to be 120M, then MEMORY_TARGET should be at least 392M (272M + 120M).

    例如,如果SGA_TARGET is 272M, PGA_AGGREGATE_TARGET is 90M,maximum PGA allocated is 120M,那么MEMORY_TARGET 的最小值为:392M (272M + 120M)。

    这只是他的最小值!你也可以将值设置的更大,前提是有足够的物理内存!

    3:For the MEMORY_MAX_TARGET initialization parameter, decide on a maximum amount of memory that you would want to allocate to the database for the foreseeable future. That is, determine the maximum value for the sum of the SGA and instance PGA sizes. This number can be larger than or the same as the MEMORY_TARGET value that you chose in the previous step.

    MEMORY_MAX_TARGET 这个参数的设置要大于或者等于MEMORY_TARGET 参数的值。根据网上的一些经验之谈MEMORY_MAX_TARGET = OS_MEMORY*80%这参数的值没有固定公式可参考!要根据实际情况来确定!!

    修改参数的脚本:

    ALTER SYSTEM SET MEMORY_MAX_TARGET = nM SCOPE = SPFILE;
    如果修改了该参数MEMORY_MAX_TARGET 需重启实例!

    The dynamic performance view V$MEMORY_DYNAMIC_COMPONENTS shows the current sizes of all dynamically tuned memory components, including the total sizes of the SGA and instance PGA.

    动态视图V$MEMORY_DYNAMIC_COMPONENTS 显示了当前动态内存组件的大小。包括SGA,PGA的总大小!

    The view V$MEMORY_TARGET_ADVICE provides tuning advice for the MEMORY_TARGET initialization parameter.

    SQL>  select * from v$memory_target_advice order by memory_size;
     
    MEMORY_SIZE MEMORY_SIZE_FACTOR ESTD_DB_TIME ESTD_DB_TIME_FACTOR    VERSION
    ----------- ------------------ ------------ ------------------- ----------
            180                 .5          458               1.344          0
            270                .75          367              1.0761          0
            360                  1          341                   1          0
            450               1.25          335               .9817          0
            540                1.5          335               .9817          0
            630               1.75          335               .9817          0
            720                  2          335               .9817          0
    

    The row with the MEMORY_SIZE_FACTOR of 1 shows the current size of memory, as set by the MEMORY_TARGET initialization parameter, and the amount of DB time required to complete the current workload. In previous and subsequent rows, the results show several alternative MEMORY_TARGET sizes. For each alternative size, the database shows the size factor (the multiple of the current size), and the estimated DB time to complete the current workload if the MEMORY_TARGET parameter were changed to the alternative size. Notice that for a total memory size smaller than the current MEMORY_TARGET size, estimated DB time increases. Notice also that in this example, there is nothing to be gained by increasing total memory size beyond 450MB. However, this situation might change if a complete workload has not yet been run.





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值