当前位置:数据库 > Oracle >>

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

Oracle自动内存管理的几个小问题
 
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.
 
01
sys@HUA>show parameter memory;
02

03
NAME                                 TYPE        VALUE
04
------------------------------------ ----------- ------------------------------
05
hi_shared_memory_address             integer     0
06
memory_max_target                    big integer 0
07
memory_target                        big integer 0
08
shared_memory_address                integer     0
09
sys@HUA>show parameter sga
10

11
NAME                                 TYPE        VALUE
12
------------------------------------ ----------- ------------------------------
13
lock_sga                             boolean     FALSE
14
pre_page_sga                         boolean     FALSE
15
sga_max_size                         big integer 440M
16
sga_target                           big integer 440M
17
sys@HUA>alter system set sga_target=0;
18

19
System altered.
20

21
sys@HUA>show parameter pool;
22

23
NAME                                 TYPE        VALUE
24
------------------------------------ ----------- ------------------------------
25
_shared_io_pool_size                 big integer 0
26
buffer_pool_keep                     string
27
buffer_pool_recycle                  string
28
global_context_pool_size             string
29
java_pool_size                       big integer 4M
30
large_pool_size                      big integer 8M
31
olap_page_pool_size                  big integer 0
32
shared_pool_reserved_size            big integer 7549747
33
shared_pool_size                     big integer 208M
34
streams_pool_size                    big integer 0
35
sys@HUA>alter system set sga_target=440;
36

37
System altered.
38

39
sys@HUA>show parameter pool;
40

41
NAME                                 TYPE        VALUE
42
------------------------------------ ----------- ------------------------------
43
_shared_io_pool_size                 big integer 0
44
buffer_pool_keep                     string
45
buffer_pool_recycle                  string
46
global_context_pool_size             string
47
java_pool_size                       big integer 4M
48
large_pool_size                      big integer 8M
49
olap_page_pool_size                  big integer 0
50
shared_pool_reserved_size            big integer 7549747
51
shared_pool_size                     big integer 208M
52
streams_pool_size                    big integer 0
53
sys@HUA>alter system set java_pool_size=0;
54

55
System altered.
56

57
sys@HUA>alter system set large_pool_size=0;
58

59
System altered.
60

61
sys@HUA>alter system set shared_pool_size=0;
62

63
System altered.
64

65
sys@HUA>
66
sys@HUA>show parameter pool;
67

68
NAME                                 TYPE        VALUE
69
------------------------------------ ----------- ------------------------------
70
_shared_io_pool_size                 big integer 0
71
buffer_pool_keep                     string
72
buffer_pool_recycle                  string
73
global_context_pool_size             string
74
java_pool_size                       big integer 0
75
large_pool_size                      big integer 0
76
olap_page_pool_size                  big integer 0
77
shared_pool_reserved_size            big integer 7549747
78
shared_pool_size                     big integer 0
79
streams_pool_size                    big integer 0
80
sys@HUA>
81
sys@HUA>
82
sys@HUA>alter system set sga_target=0;
83

84
System altered.
85

86
sys@HUA>show parameter pool;
87

88
NAME                                 TYPE        VALUE
89
------------------------------------ ----------- ------------------------------
90
_shared_io_pool_size                 big integer 0
91
buffer_pool_keep                     string
92
buffer_pool_recycle                  string
93
global_context_pool_size             string
94
java_pool_size                       big integer 4M
95
large_pool_size                      big integer 8M
96
olap_page_pool_size                  big integer 0
97
shared_pool_reserved_size            big integer 7549747
98
shared_pool_size                     big integer 208M
99
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.
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,