自動記憶體管理類型
- 自動記憶體管理:Oracle 11g的新特性,允許資料庫完全自動地管理記憶體的SGA和PGA組件
- 自動共用記憶體管理:應用此選擇,可以自動管理SGA,但是不自動管理PGA。
- 自動PGA記憶體管理:此選項只能自動管理SGA。
- 手動共用記憶體管理:手動設定SGA的組件尺寸,如:shared_pool,data_buffer
- 手動PGA管理:手動設定PGA組件尺寸
開啟自動記憶體管理
為開啟自動記憶體管理,必須設定memory_target參數,該參數設定執行個體的目標記憶體。也可以指定memory_max_target初始化參數設定一個執行個體的最大記憶體尺寸。
在用新的自動記憶體管理特性給資料庫分配適當的尺寸之前,必須首先尋找當前有多少記憶體配置給了SGA和PGA。但是並不意味簡單的將sga_target和pga_target參數求和相加的記憶體需求。原因是:與sga_target參數不同,資料庫不立即接管分配給pga_target參數的記憶體。資料庫只根據pga_target參數設定將PGA分配給每個部分,因此,你的pga_target也許分配得很大,但是資料庫在給定時間內卻只是用了很小的一部分。
推薦閱讀:
Oracle 記憶體自動管理
Oracle安裝過程實體記憶體檢查及臨時temp空間不足解決辦法
因此需要做如下操作,來確定自動記憶體管理的記憶體大小
1、尋找當前SGA大小
SQL> show parameter sga
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sga_target big integer 600M
2、尋找給定時間內分配給PGA的大小
SQL> select value from v$pgastat where name='maximum PGA allocated';
VALUE
----------
248707072
3、2步得到的查詢結果顯示PGA分配的最大記憶體大約為236M,執行一下操作 得到一個錯誤的PGA估計
SQL> show parameter pga_
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
pga_aggregate_target big integer 400000000
4、通過將SGA_TARGET參數值和執行個體啟動以來分配給PGA最大的記憶體值相加,選擇memory_target參數值。(600+236)。如果需要,也可以設定memory_max_target,如果不給定該參數值,將使用memory_target的值。
設定:
alter system set memory_target=1200M scope=spfile;
alter system set memory_max_target=1000M scope=spfile;
alter system set sga_target=1200M scope=spfile;
alter system set pga_aggregate_target=1200M scope=spfile;
oracle記憶體管理方法的總結:
Instance |
SGA |
PGA |
Description |
Initialization Parameters |
Auto |
n/a |
n/a |
The database tunes the size of the instance based on a single instance target size. |
You set:
|
n/a |
Auto |
Auto |
The database automatically tunes the SGA based on an SGA target. The database automatically tunes the PGA based on a PGA target. |
You set:
SGA target size (SGA_TARGET )
Optional SGA maximum size (SGA_MAX_SIZE )
Instance PGA target size (PGA_AGGREGATE_TARGET )
|
n/a |
Auto |
Manual |
The database automatically tunes the SGA based on an SGA target. You control the PGA manually, setting the maximum work area size for each type of SQL operator. |
You set:
SGA target size (SGA_TARGET )
Optional SGA maximum size (SGA_MAX_SIZE )
PGA work area parameters such as SORT_AREA_SIZE , HASH_AREA_SIZE , and BITMAP_MERGE_AREA_SIZE
|
n/a |
Manual |
Auto |
You control the SGA manually by setting individual component sizes. The database automatically tunes the PGA based on a PGA target. |
You set:
Shared pool size (SHARED_POOL_SIZE )
Buffer cache size (DB_CACHE_SIZE )
Large pool size (LARGE_POOL_SIZE )
Java pool size (JAVA_POOL_SIZE )
Streams pool size (STREAMS_POOL_SIZE )
Instance PGA target size (PGA_AGGREGATE_TARGET )
|
n/a |
Manual |
Manual |
You must manually configure SGA component sizes. You control the PGA manually, setting the maximum work area size for each type of SQL operator. |
You must manually configure SGA component sizes. You set:
Shared pool size (SHARED_POOL_SIZE )
Buffer cache size (DB_CACHE_SIZE )
Large pool size (LARGE_POOL_SIZE )
Java pool size (JAVA_POOL_SIZE )
Streams pool size (STREAMS_POOL_SIZE )
PGA work area parameters such as SORT_AREA_SIZE , HASH_AREA_SIZE , and BITMAP_MERGE_AREA_SIZE
|
繼續閱讀: