關於memory_max_target,memory_target,sga_max_size,sga_target
從上面描述中可以先明確幾點:
1、memory_max_target值限制了memory_targe的值。如果你需要加大memory_target並且加大的值大於memory_max_target值需要先把memory_max_target 值調大。
2、如果沒有設定memory_max_target引數,那麼memory_max_target會自動取memory_target的引數值。
3、如果沒有設定memory_target但是設定了memory_max_target,那麼memory_target預設為0,需要手動設定大小
4、如果memory_target為0,那麼需要資料庫的模式為 IMMEDIATE mode,否則會報ORA-04031錯誤。這點我在11.1.0.7環境中未驗證,不知道是否是11.2的,V$MEMORY_RESIZE_OPS這個檢視中的 OPER_MODE都是空列.
另外,根據已經測試的情況:
1、初始話引數中不存在memory_max_target和memory_target,預設值為系統的shm的值,而shm值為系統實體記憶體的一半。
2、要改大memory_target需要先調整shm的值,然後修改memory_max_target,最後調整memory_target。
3、調整方法是shm需要umount /dev/shm,然後在fstab檔案中default列後面加上:,sieze=nM,n為需要調整的記憶體值,一般我會把n值比要設定的memory_max_target大一些,接著mount /dev/shm,shm值就調整好了。另外umount之前需要把資料庫和叢集都關閉,否則shm無法umount。
4、memory_max_target是靜態引數,修改的時候只能指定scope=spfile引數,memory_target是動態引數,可以直接修改,但是修改的時候還是必須保證修改的值小於memory_max_target的值,所以在增大玩memory_max_target後需要重啟資料庫保證引數生效才行。另外在叢集環境下memory_target引數是單例項修改,需要後面加上引數sid='*'表示全部例項修改。
再來看下sga的2個引數:
SGA_MAX_SIZE
Property | Description |
---|---|
Parameter type | Big integer |
Syntax | SGA_MAX_SIZE = integer [K | M | G] |
Default value | Initial size of SGA at startup, dependent on the sizes of different pools in the SGA, such as buffer cache, shared pool, large pool, and so on. |
Modifiable | No |
Range of values | 0 to operating system-dependent |
SGA_MAX_SIZE specifies the maximum size of the SGA for the lifetime of the instance.
On 64-bit platforms and non-Windows 32-bit platforms, when either MEMORY_TARGET or MEMORY_MAX_TARGET is specified, the default value of SGA_MAX_SIZE is set to the larger of the two parameters. This causes more address space to be reserved for expansion of the SGA.
On Windows 32-bit platforms, the default value of SGA_MAX_SIZE is the largest of the following values:
60% of MEMORY_TARGET, if specified
60% of MEMORY_MAX_TARGET, if specified
25% of the total available virtual address space
SGA_TARGET
Property | Description |
---|---|
Parameter type | Big integer |
Syntax | SGA_TARGET = integer [K | M | G] |
Default value | 0 (SGA autotuning is disabled for DEFERRED mode autotuning requests, but allowed for IMMEDIATE mode autotuning requests) |
Modifiable | ALTER SYSTEM |
Range of values | 64 MB to operating system-dependent |
Basic | Yes |
SGA_TARGET specifies the total size of all SGA components. If SGA_TARGET is specified, then the following memory pools are automatically sized:
Buffer cache (DB_CACHE_SIZE)
Shared pool (SHARED_POOL_SIZE)
Large pool (LARGE_POOL_SIZE)
Java pool (JAVA_POOL_SIZE)
Streams pool (STREAMS_POOL_SIZE)
If these automatically tuned memory pools are set to nonzero values, then 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.
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 block sizes
Fixed SGA and other internal allocations
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.
In the Default value field, IMMEDIATE mode autotuning requests are necessary to avoid errors. The DEFERRED and IMMEDIATE modes are reflected in the OPER_MODE column of the V$MEMORY_RESIZE_OPS view.
這邊可以看到sga_max_size、 sga_target和前面的memory類似,不過sga_target引數的介紹關於預設值0可能有問題,按這個文件的說法開啟AMM( Automatic Memory Management)的方法就是設定sga_target=0,同樣在11.1中的 V$MEMORY_RESIZE_OPS 檢視也沒有看到OPEN_MODE的值。
關於設定 sga_max_size、 sga_target 的引數可以參看下這篇文件,
實際測試中發現預設的初始化檔案中是不存在 sga_max_size,也不要去手動設定這個引數值,一旦使用alter system set sga_max_size 後引數檔案中就會加上這個引數,而且不能設定成0,所以如果不小心設定了 sga_max_size 最好的方法是先生成pfile檔案,將該引數刪除在用pfile檔案生成spfile檔案,如果在叢集環境下生成spfile的檔案切記加上spfile檔案的路徑,否則會生成到dbs路徑下。
AMM和ASMM( Automatic SGA Memory)這2者的區別就在於sga_target這個值,如果是0表示開啟了AMM來管理sga,否則用開啟ASMM管理sga。AMM是11g新增的功能,10g新增了ASMM,9i新增了APM( Automatic PGA Memory)
大概就這些先,有問題的請留言。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29067253/viewspace-2099931/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORA-00837: Specified value of MEMORY_TARGET greater than MEMORY_MAX_TARGET
- ORA-00843,ORA-00849 When Trying To Change SGA_TARGET With MEMORY_MAX_TARGET=0
- MEMORY_TARGET not supported on this system
- statistics_level與SGA_TARGET衝突
- Incorrect MEMORY_MAX_TARGET (> Available RAM) Can Lead To Database HangsAIDatabase
- Oracle Rac 修改SGA_TARGET值無變化Oracle
- 解決辦法:ORA-00845: MEMORY_TARGET not supported on thi
- 關於IT,關於技術
- [20190507]sga_target=0注意修改_kghdsidx_count設定.txt
- [20190104]sga_target 的設定和ORA-04031錯誤.txt
- 關於++[[]][+[]]+[+[]]
- 關於
- 關於~
- 關於LaTex
- 關於索引索引
- 關於EchartsEcharts
- 關於HTMLHTML
- 關於startActivityForResult
- 關於AUC
- 關於RE
- 關於pythonPython
- 關於REMREM
- 關於悟道
- 關於神通
- 關於RedisRedis
- 關於IntentIntent
- 關於 kafkaKafka
- 關於mavenMaven
- 關於我
- 關於思路
- 關於列印
- 關於namespacenamespace
- 關於NVMe
- 關於RESTREST
- 關於 webmWeb
- 關於液泡
- 關於 ArrayBuffer
- 關於 UndefinedUndefined
- 關於 WinDoAdmin