今天把虛擬機器的記憶體改小了一點,然後啟動資料的時候就出現如下錯誤:
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
我猜想應該是系統記憶體和sga衝突的問題,後來到網上查了一下,果然如此:
來自Oracle的官方解析是:
Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors. The size of the shared memory should be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer. If MEMORY_MAX_TARGET or MEMORY_TARGET is set to a non zero value, and an incorrect size is assigned to the shared memory, it will result in an ORA-00845 error at startup.
也就是由於設定SGA的大小超過了作業系統/dev/shm的大小:
解決這個問題只有兩個方法,一種是修改初始化參數,使得初始化參數中SGA的設定小於/dev/shm的大小,另一種方法就是調整/dev/shm的大小。
一.修改/dev/shm的大小
root 登入
- #vi /etc/fstab
- tmpfs /dev/shm tmpfs defaults,size=320M 0 0
將上面的size改成超過sga的大小。然後重啟或者重新掛載
#umount /dev/shm
#mount /dev/shm
二.修改sga的大小
alter system set sga_max_size=**** scope=spfile;
然後重新啟動資料庫。