ORACLE 11g 自动内存管理
Overview
在oracle 11g中,使用一個參數memory_target就能夠實現SGA和PGA組件依據工作負荷進行自動內存分配。oracle推薦使用自動內存管理簡化內存分配。
oracle 11g依然支持手工內存分配:
1:oracle 11g使用memory_target來支持內存自動分配。
2:使用sga_target和pga_target參數來設置SGA和PGA,數據庫會在這兩個組件中自我優化。
3:你也可以手工設置SGA中的各個組件。比如db_cache_size,shared_pool_size等組件。
oracle 11g中新的內存初始化參數:
有兩個新的關鍵的內存初始化參數memory_target(動態參數,設置分配給實例的內存數)和memory_max_size(靜態參數,這個參數是可選的,設置實例能夠分配的最大內存,設置的是memory_target的上限值)。
注意:雖然memory_target是一個動態參數,但是當數據庫運行時,你不能從非自動內存管理交換到自動內存管理。必須重啟數據庫將參數應用到實例啟動過程才行。
When you upgrade to Oracle Database 11g using the DBUA (Database Upgrade Assistant), by default, the memory_target parameter is set to zero, meaning automatic memory management is disabled by default. However, when you create a new database using the DBCA (Database Creation Assistant), you can specify automatic memory management. You specify your choice in the Initialization Parameters page by clicking the Memory tab on that page. Following are two options offered on that page:
- The Typical option lets you configure memory for a new database with minimal input and is ideal for most environments. Just enter a value in the Memory Size field and check the Use Automatic Memory Management option in the Typical section of the page to institute automatic memory management for the new database.
- The Custom option provides you more control over the allocation of memory to the database. You can select the Automatic option to allocate specific amounts of memory to the SGA and PGA components of database memory. You can select the Manual option to set specific memory allocations for SGA subcomponents such as the buffer pool and the shared pool.
參數配置策略
MEMORY_TARGET 設置為非零值時:
?
如果未設置 MEMORY_TARGET,或者將其顯式設置為 0(11g 中的默認值為 0)時:
Monitoring Automatic Memory Management
Use the V$MEMORY_DYNAMIC_COMPONENTS view to monitor the current sizes of all dynamically tuned memory components, as shown here:
SQL> select component, current_size, user_specified_size
?? 2? from v$memory_dynamic_components
?? 3* where current_size!=0;
COMPONENT????????????? CURRENT_SIZE????? USER_SPECIFIED_SIZE
-------------------??? --------------??? -------------------
shared pool??????????? 109051904???????? 0
large pool???????????? 4194304?????????? 0
java pool????????????? 12582912????????? 0
SGA Target???????????? 134217728???????? 0
DEFAULT buffer cache?? 4194304?????????? 0
PGA Target???????????? 130023424???????? 0
6 rows selected.
As you can see, the query also shows the current total size of the SGA and the PGA components. The V$MEMORY_RESIZE_OPS view contains a circular buffer of the 800 most recent completed memory resizing operations. You can find the current memory resize operations that are in progress by querying the V$MEMORY_ CURRENT_RESIZE_OPS view.
ORA-00845
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
這是因為/dev/shm沒有設置正確的值,確保這個值至少等于sga_max_size參數值。
[oracle@node1 dbs]$ df -h
Filesystem??????????? Size? Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
?????????????????????? 14G? 9.4G? 3.2G? 75% /
/dev/sda1????????????? 99M?? 14M?? 81M? 15% /boot
none????????????????? 2.0G? 702M? 1.4G? 35% /dev/shm
可以看到該值為2G。
可以通過/etc/fstab來更改該值:
默認情況下該文件相關內容如下:
[oracle@node1 dbs]$ cat /etc/fstab |grep shm
none??????????????????? /dev/shm??????????????? tmpfs?? defaults?????? 0 0
可以將該值修改為如下:
none??????????????????? /dev/shm??????????????? tmpfs?? defaults,size=2G??????? 0 0
然后重啟系統即可解決問題。
總結
以上是生活随笔為你收集整理的ORACLE 11g 自动内存管理的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: undo表空间暴长,如何取消自动扩展
- 下一篇: ORA-600[4194]/[4193]