ORACLE AMM 、ASMM 、自動記憶體管理(官方手冊)
About Automatic Memory Management
The simplest way to manage instance memory is to allow the Oracle Database instance to automatically manage and tune it for you. 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). 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.
When automatic memory management is not enabled, you must size both the SGA and instance PGA manually.
Because the MEMORY_TARGET initialization parameter is dynamic, you can change MEMORY_TARGET at any time without restarting the database. 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.
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.
Enabling Automatic Memory Management
If you did not enable automatic memory management upon database creation (either by selecting the proper options in DBCA or by setting the appropriate initialization parameters for the CREATE DATABASE SQL statement), you can enable it at a later time. Enabling automatic memory management involves a shutdown and restart of the database.
To enable automatic memory management
-
Start SQL*Plus and connect to the database as SYSDBA.
-
Calculate the minimum value for MEMORY_TARGET as follows:
-
Determine the current sizes of SGA_TARGET and PGA_AGGREGATE_TARGET by entering the following SQL*Plus command:
SHOW PARAMETER TARGET
SQL*Plus displays the values of all initialization parameters with the string TARGET in the parameter name.
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 parallel_servers_target integer 16 pga_aggregate_target big integer 90M sga_target big integer 272M
-
Run the following query to determine the maximum instance PGA allocated since the database was started:
select value from v$pgastat where name='maximum PGA allocated';
-
Compute the maximum value between the query result from step 2b and PGA_AGGREGATE_TARGET. Add SGA_TARGET to this value.
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).
-
-
Choose the value for MEMORY_TARGET that you want to use.
This can be the minimum value that you computed in step 2, or you can choose to use a larger value if you have enough physical memory available.
-
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.
-
Do one of the following:
-
If you started your Oracle Database instance with a server parameter file, which is the default if you created the database with the Database Configuration Assistant (DBCA), enter the following command:
ALTER SYSTEM SET MEMORY_MAX_TARGET = nM SCOPE = SPFILE;
where n is the value that you computed in Step 4.
The SCOPE = SPFILE clause sets the value only in the server parameter file, and not for the running instance. You must include this SCOPE clause because MEMORY_MAX_TARGET is not a dynamic initialization parameter.
-
If you started your instance with a text initialization parameter file, manually edit the file so that it contains the following statements:
memory_max_target = nM memory_target = mM
where n is the value that you determined in Step 4, and m is the value that you determined in step 3.
Note:
In a text initialization parameter file, if you omit the line for MEMORY_MAX_TARGET and include a value for MEMORY_TARGET, the database automatically sets MEMORY_MAX_TARGET to the value of MEMORY_TARGET. If you omit the line for MEMORY_TARGET and include a value for MEMORY_MAX_TARGET, the MEMORY_TARGET parameter defaults to zero. After startup, you can then dynamically change MEMORY_TARGET to a nonzero value, provided that it does not exceed the value of MEMORY_MAX_TARGET. -
-
Shut down and restart the database.
-
If you started your Oracle Database instance with a server parameter file, enter the following commands:
ALTER SYSTEM SET MEMORY_TARGET = nM; ALTER SYSTEM SET SGA_TARGET = 0; ALTER SYSTEM SET PGA_AGGREGATE_TARGET = 0;
where n is the value that you determined in step 3.
About Automatic Shared Memory Management
Automatic Shared Memory Management simplifies SGA memory management. You specify the total amount of SGA memory available to an instance using theSGA_TARGET initialization parameter and Oracle Database automatically distributes this memory among the various SGA components to ensure the most effective memory utilization.
When automatic shared memory management is enabled, the sizes of the different SGA components are flexible and can adapt to the needs of a workload without requiring any additional configuration. The database automatically distributes the available memory among the various components as required, allowing the system to maximize the use of all available SGA memory.
If you are using a server parameter file (SPFILE), the database remembers the sizes of the automatically tuned SGA components across instance shutdowns. As a result, the database instance does not need to learn the characteristics of the workload again each time the instance is started. The instance can begin with information from the previous instance and continue evaluating workload where it left off at the last shutdown.
distibute:分配。
Components and Granules in the SGA
The SGA comprises several memory components, which are pools of memory used to satisfy a particular class of memory allocation requests. Examples of memory components include the shared pool (used to allocate memory for SQL and PL/SQL execution), the java pool (used for java objects and other java execution memory), and the buffer cache (used for caching disk blocks). All SGA components allocate and deallocate space in units of granules. Oracle Database tracks SGA memory use in internal numbers of granules for each SGA component.
The memory for dynamic components in the SGA is allocated in the unit of granules. Granule size is determined by total SGA size. Generally speaking, on most platforms, if the total SGA size is equal to or less than 1 GB, then granule size is 4 MB. For SGAs larger than 1 GB, granule size is 16 MB. Some platform dependencies may arise. For example, on 32-bit Windows NT, the granule size is 8 MB for SGAs larger than 1 GB. Consult your operating system specific documentation for more details.
You can query the V$SGAINFO view to see the granule size that is being used by an instance. The same granule size is used for all components in the SGA.
If you specify a size for a component that is not a multiple of granule size, Oracle Database rounds the specified size up to the nearest multiple. For example, if the granule size is 4 MB and you specify DB_CACHE_SIZE as 10 MB, the database actually allocates 12 MB.
Enabling Manual Shared Memory Management
There is no initialization parameter that in itself enables manual shared memory management. You effectively enable manual shared memory management by disabling both automatic memory management and automatic shared memory management.
To enable manual shared memory management:
-
Set the MEMORY_TARGET initialization parameter to 0.
-
Set the SGA_TARGET initialization parameter to 0.
You must then set values for the various SGA components, as described in the following sections.
Enabling Automatic Shared Memory Management
The procedure for enabling automatic shared memory management (ASMM) differs depending on whether you are changing to ASMM from manual shared memory management or from automatic memory management.
To change to ASMM from manual shared memory management:
-
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;
-
Set the value of SGA_TARGET, either by editing the text initialization parameter file and restarting the database, or by issuing the following statement:
ALTER SYSTEM SET SGA_TARGET=value [SCOPE={SPFILE|MEMORY|BOTH}]
where value is the value computed in step 1 or is some value between the sum of all SGA component sizes and SGA_MAX_SIZE. For more information on the ALTER SYSTEM statement and its SCOPE clause, see Oracle Database SQL Language Reference.
-
Do one of the following:
-
For more complete automatic tuning, set the values of the automatically sized SGA components listed in Table 6-1 to zero. Do this by editing the text initialization parameter file or by issuing ALTER SYSTEM statements.
-
To control the minimum size of one or more automatically sized SGA components, set those 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.
-
To change to ASMM from automatic memory management:
-
Set the MEMORY_TARGET initialization parameter to 0.
ALTER SYSTEM SET MEMORY_TARGET = 0;
The database sets SGA_TARGET based on current SGA memory allocation.
-
Do one of the following:
-
For more complete automatic tuning, set the sizes of the automatically sized SGA components listed in Table 6-1 to zero. Do this by editing the text initialization parameter file or by issuing ALTER SYSTEM statements.
-
To control the minimum size of one or more automatically sized SGA components, set those component sizes to the desired value. (See the next section for details.) Set the sizes of the other automatically sized SGA components to zero. Do this by editing the text initialization parameter file or by issuing ALTER SYSTEM statements.
-
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31520497/viewspace-2156851/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【記憶體管理】Oracle AMM自動記憶體管理詳解記憶體Oracle
- 【記憶體管理】Oracle如何使用ASMM自動共享記憶體管理記憶體OracleASM
- oracle 11g自動記憶體管理Oracle記憶體
- 【ORA-4030/4031】自動記憶體管理AMM中的ORA-4030/4031問題記憶體
- golang手動管理記憶體Golang記憶體
- JVM學習-自動記憶體管理JVM記憶體
- JVM學習筆記——自動記憶體管理JVM筆記記憶體
- JVM自動記憶體管理機制 二JVM記憶體
- 記憶體管理 記憶體管理概述記憶體
- 記憶體管理篇——實體記憶體的管理記憶體
- JVM 自動記憶體管理機制及 GC 演算法JVM記憶體GC演算法
- 【記憶體管理】記憶體佈局記憶體
- 記憶體管理兩部曲之實體記憶體管理記憶體
- 自動記憶體管理機制_執行時資料區域記憶體
- Go:記憶體管理與記憶體清理Go記憶體
- Java的記憶體 -JVM 記憶體管理Java記憶體JVM
- C語言之動態記憶體管理C語言記憶體
- 從Oracle資料庫故障到AIX記憶體管理Oracle資料庫AI記憶體
- Oracle 11gR2 ASM例項記憶體管理OracleASM記憶體
- 深入理解Java虛擬機器筆記-自動記憶體管理機制Java虛擬機筆記記憶體
- 記憶體管理兩部曲之虛擬記憶體管理記憶體
- 深入理解Java虛擬機器(自動記憶體管理機制)Java虛擬機記憶體
- Flink記憶體管理記憶體
- 記憶體管理-swMemoryGlobal記憶體
- MySQL記憶體管理MySql記憶體
- JavaScript 記憶體管理JavaScript記憶體
- iOS 記憶體管理iOS記憶體
- Android記憶體管理Android記憶體
- OC記憶體管理記憶體
- C++動態記憶體管理——new/deleteC++記憶體delete
- OracleASM關閉AMM,開啟ASMM,修改引數後報ORA-00843 ORA-00849OracleASM
- 【精選】Mac 手動記憶體清理教程Mac記憶體
- linux記憶體管理(一)實體記憶體的組織和記憶體分配Linux記憶體
- Linux實體記憶體管理Linux記憶體
- Redis4.0如何自動清理記憶體碎片Redis記憶體
- 【大頁記憶體】Oracle資料庫配置大頁記憶體記憶體Oracle資料庫
- C++記憶體管理C++記憶體
- Windows記憶體管理-分段Windows記憶體