Oracle自动内存管理的几个小问题

99封情书 提交于 2020-03-02 05:56:20

1) 开启了自动内存管理之后,如果有pool的值设置为非0值会怎么处理?

比如,设置了sga_target=10G,但是java_pool_size设置为10m,这时,10m会作为java pool的最少分配内存空间。

If these automatically tuned memory pools had been set to nonzero values, those values are used as minimum levels by Automatic Shared Memory Management. You would set minimum values if an application component needs a minimum amount of memory to function properly.

2) 关闭自动管理后,相关pool的值会被自动设置。

If you dynamically disable SGA_TARGET by setting its value to 0 at instance startup, Automatic Shared Memory Management will be disabled and the current auto-tuned sizes will be used for each memory pool.
sys@HUA>show parameter memory;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 0
memory_target                        big integer 0
shared_memory_address                integer     0
sys@HUA>show parameter sga

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 440M
sga_target                           big integer 440M
sys@HUA>alter system set sga_target=0;

System altered.

sys@HUA>show parameter pool;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
_shared_io_pool_size                 big integer 0
buffer_pool_keep                     string
buffer_pool_recycle                  string
global_context_pool_size             string
java_pool_size                       big integer 4M
large_pool_size                      big integer 8M
olap_page_pool_size                  big integer 0
shared_pool_reserved_size            big integer 7549747
shared_pool_size                     big integer 208M
streams_pool_size                    big integer 0
sys@HUA>alter system set sga_target=440;

System altered.

sys@HUA>show parameter pool;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
_shared_io_pool_size                 big integer 0
buffer_pool_keep                     string
buffer_pool_recycle                  string
global_context_pool_size             string
java_pool_size                       big integer 4M
large_pool_size                      big integer 8M
olap_page_pool_size                  big integer 0
shared_pool_reserved_size            big integer 7549747
shared_pool_size                     big integer 208M
streams_pool_size                    big integer 0
sys@HUA>alter system set java_pool_size=0;

System altered.

sys@HUA>alter system set large_pool_size=0;

System altered.

sys@HUA>alter system set shared_pool_size=0;

System altered.

sys@HUA>
sys@HUA>show parameter pool;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
_shared_io_pool_size                 big integer 0
buffer_pool_keep                     string
buffer_pool_recycle                  string
global_context_pool_size             string
java_pool_size                       big integer 0
large_pool_size                      big integer 0
olap_page_pool_size                  big integer 0
shared_pool_reserved_size            big integer 7549747
shared_pool_size                     big integer 0
streams_pool_size                    big integer 0
sys@HUA>
sys@HUA>
sys@HUA>alter system set sga_target=0;

System altered.

sys@HUA>show parameter pool;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
_shared_io_pool_size                 big integer 0
buffer_pool_keep                     string
buffer_pool_recycle                  string
global_context_pool_size             string
java_pool_size                       big integer 4M
large_pool_size                      big integer 8M
olap_page_pool_size                  big integer 0
shared_pool_reserved_size            big integer 7549747
shared_pool_size                     big integer 208M
streams_pool_size                    big integer 0

3) 是否有在SGA内的组件,但是却不在自动内存管理之内的?

The following pools are manually sized components and are not affected by Automatic Shared Memory Management: * Log buffer * Other buffer caches (such as KEEP, RECYCLE, and other nondefault block size) * Fixed SGA and other internal allocations To manually size these memory pools, you must set the DB_KEEP_CACHE_SIZE, DB_RECYCLE_CACHE_SIZE, DB_nK_CACHE_SIZE, and LOG_BUFFER initialization parameters. The memory allocated to these pools is deducted from the total available for SGA_TARGET when Automatic Shared Memory Management computes the values of the automatically tuned memory pools.

4) 组件之间“挪借”内存空间,是按什么单位进行?是一个一个字节来分配?

Memory for the shared pool, large pool, java pool, and buffer cache is allocated in units of granules. The granule size is 4MB if the SGA size is less than 1GB. If the SGA size is greater than 1GB, the granule size changes to 16MB. The granule size is calculated and fixed when the instance starts up. The size does not change during the lifetime of the instance.
The granule size that is currently being used for SGA can be viewed in the view V$SGA_DYNAMIC_COMPONENTS. The same granule size is used for all dynamic components in the SGA.

5) 如果使用了自动内存管理,每个pool的值都设置为0了,那如何查看当前每个pool的当前值?

V$MEMORY_DYNAMIC_COMPONENTS displays information about the current sizes of all dynamically tuned memory components, including the total sizes of the SGA and instance PGA.


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!