Automatic Shared Memory Management simplifies SGA memory management. You specify the total amount of SGA memory available to an instance using the SGA_TARGET initialization parameter and Oracle Database automatically distributes this memory among the various SGA components to ensure the most effective memory utilization.
设置SGA_TARGET来实现自动管理SGA
The SGA_MAX_SIZE initialization parameter specifies the maximum size of the System Global Area for the lifetime of the instance. You can dynamically alter the initialization parameters affecting the size of the buffer caches, shared pool, large pool, Java pool, and streams pool but only to the extent that the sum of these sizes and the sizes of the other components of the SGA (fixed SGA, variable SGA, and redo log buffers) does not exceed the value specified by SGA_MAX_SIZE.
SGA_MAX_SIZE参数指定最大大小系统全局区域为整个实例的生存周期中,你可以动态的改变参数来影响 buffer caches, shared pool, large pool, Java pool, and streams pool的大小只有当这些大小的总数和其他组建(fixed SGA, variable SGA, and redo log buffers)的大小的总数不超过他。
If you do not specify SGA_MAX_SIZE, then Oracle Database selects a default value that is the sum of all components specified or defaulted at initialization time. If you do specify SGA_MAX_SIZE, and at the time the database is initialized the value is less than the sum of the memory allocated for all components, either explicitly in the parameter file or by default, then the database ignores the setting for SGA_MAX_SIZE and chooses a correct value for this parameter.
如果你没有指定 SGA_MAX_SIZE,那么数据库选择默认的总的组建大小的值,或者默认在初始时间。如果你没指定SGA_MAX_SIZE,并且在那段时间数据库少于总的大小,或者超过默认参数文件,那么数据库忽略设置SGA_MAX_SIZE,选择正确的值。
You enable the automatic shared memory management feature by setting the SGA_TARGET parameter to a nonzero value. This parameter sets the total size of the SGA. It replaces the parameters that control the memory allocated for a specific set of individual components, which are now automatically and dynamically resized (tuned) as needed.
你可以开启自动管理共享内存,通过设置SGA_TARGET为非零值,这个参数设置总的SGA大小。他取代控制独自组建的内存大小,现在可以根据需要自动调整大小。
The STATISTICS_LEVEL initialization parameter must be set to TYPICAL (the default) or ALL for automatic shared memory management to function.
STATISTICS_LEVEL这个参数必须设置为TYPICAL或者ALL为自动管理共享内存的功能。
able 6-1 Automatically Sized SGA Components and Corresponding Parameters
| SGA Component | Initialization Parameter |
|---|---|
|
Fixed SGA and other internal allocations needed by the Oracle Database instance |
N/A |
|
The shared pool |
SHARED_POOL_SIZE |
|
The large pool |
LARGE_POOL_SIZE |
|
The Java pool |
JAVA_POOL_SIZE |
|
The buffer cache |
DB_CACHE_SIZE |
|
The Streams pool |
STREAMS_POOL_SIZE |
| SGA Component | Initialization Parameter |
|---|---|
|
The log buffer |
LOG_BUFFER |
|
The keep and recycle buffer caches |
DB_KEEP_CACHE_SIZE DB_RECYCLE_CACHE_SIZE |
|
Nonstandard block size buffer caches |
DB_nK_CACHE_SIZE |
In addition to setting SGA_TARGET to a nonzero value, you must set to zero all initialization parameters listed in to enable full automatic tuning of the automatically sized SGA components.
Alternatively, you can set one or more of the automatically sized SGA components to a nonzero value, which is then used as the minimum setting for that component during SGA tuning. This is discussed in detail later in this section.
在另外设置SGA_TARGET为非零值,你必须另外设置零值为table6-1的各个组建,来达到全部调整共享内存组建。For optimal performance in most systems, the entire SGA should fit in real memory. If it does not, and if virtual memory is used to store parts of it, then overall database system performance can decrease dramatically. The reason for this is that portions of the SGA are paged (written to and read from disk) by the operating system.
为了优化性能在大多数系统中,整个SGA应该匹配真正的内存。如果不是这样的话,如果虚拟内存用来存储它,那么整个数据库性能可能急速下降。理由是这一部分的SGA被分页(读写都来自硬盘)。
监控和调整SGA目标大小
The V$SGAINFO view provides information on the current tuned sizes of various SGA components.
The
The V$SGAINFO view provides information on the current tuned sizes of various SGA components.
The V$SGA_TARGET_ADVICE view provides information that helps you decide on a value for SGA_TARGET.
V$SGAINFO 视图提供信息关于现在各个SGA组建的调整
V$SGA_TARGET_ADVICE 视图 提供信息来帮助你决定SGA_TARGET 的信息。
sys@ORCL> select * from v$sga_target_advice order by sga_size;
SGA_SIZE SGA_SIZE_FACTOR ESTD_DB_TIME ESTD_DB_TIME_FACTOR ESTD_PHYSICAL_READS
---------- --------------- ------------ ------------------- -------------------
150 .5 136 1.1724 1495
225 .75 116 1 1495
300 1 116 1 1495
375 1.25 116 1 1495
450 1.5 116 1 1495
525 1.75 116 1 1495 600 2 116 1 1495
1 Run the following query to obtain a value for SGA_TARGET:
SELECT ( (SELECT SUM(value) FROM V$SGA) - (SELECT CURRENT_SIZE FROM V$SGA_DYNAMIC_FREE_MEMORY) ) "SGA_TARGET" FROM DUAL;
SELECT (
(SELECT SUM(value) FROM V$SGA) -
(SELECT CURRENT_SIZE FROM V$SGA_DYNAMIC_FREE_MEMORY)
) "SGA_TARGET"
5 FROM DUAL;
SGA_TARGET
----------
313159680
2 alter system set sga_max_size=350 scope=spfile;
shut immediate;
startup;
alter system set sga_max_size=350 scope=spfile;
Do one of the following: 做其中两个之一
For more complete automatic tuning, set the values of the automatically sized SGA components listed in to zero. Do this by editing the text initialization parameter file or by issuing ALTER SYSTEM statements. 为了更加完全的自动调整,其他可以控制SGA组件都设置为零
To control the minimum size of one or more automatically sized SGA
components, set hose component sizes to the desired value. (See the
next section for details.) Set the values of the other automatically
sized SGA components to zero. Do this by editing the text initialization
parameter file or by issuing ALTER SYSTEM statements. 其他可以SGA组件可以非零,可以获得最小的组件的内存大小
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27137878/viewspace-735121/ ,如需转载,请注明出处,否则将追究法律责任。