原因:由於機器使用阿里雲服務器,初期內存較大,所以選擇中途降配,由8G減少到4G,降配完成後,數據庫無法正常啓動,報以下錯誤
ORA-00845: MEMORY_TARGET not supported on this system
經過查資料瞭解其原理後
發現:
原因可能:ORACLE MEMORY_TARGET參數設置超過了oracle服務器本身內存、或超過了現在服務器空閒內存(就是oracle啓動時無法獲取設置的內存),或者 超過了/dev/shm的大小/. 這些都有可能造成以上錯誤、
問題確認:
確認爲oracle MEMORY_TARGET參數設置SGA大於操作系統的空閒內存,超過了/dev/shm的大小
解決:
修改MEMORY_TARGET的值爲合適的範圍之內(如果是正式環境切oracle需要設置MEMORY_TARGET的內存,需要增加服務器內存,本初不討論)
1.備份現有spfile文件
cp init.ora.715201510237 init.ora.715201510237_bak
2.使用spfile創建pfile(spfile爲二進制文本,不可直接修改),修改pfile後,重新生成spfile
SQL> create pfile from spfile; File created.
修改pfile參數*.memory_target=104857600(此處的值小於 操作系統的空閒內存,小於/dev/shm的大小)
SQL> create spfile from pfile; File created. 確認後,啓動oracle
3,如果以上完成後,還無法正常startup,
SQL> startup pfile=/app/oracle/admin/orcl/pfile/init.ora.103201271612 SQL> alter system set memory_max_target=1258M scope=both; alter system set memory_max_target=1258200M scope=both * ERROR at line 1: ORA-02095: specified initialization parameter cannot be modified SQL> alter system set memory_max_target=1258M scope=spfile; alter system set memory_max_target=1258M scope=spfile * ERROR at line 1: ORA-32001: write to SPFILE requested but no SPFILE is in use//spfile文件可能不存在 SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down SQL> startup nomount ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/app/oracle/product/11.2.0/dbhome_2/dbs/initorcl.ora' #------------------------------spfile不存在 #-----------------------------spfile位置:$ORACLE_HOME/dbs/init[ORACLE_SID].ora #-----------------------------名字格式爲:initORACLE_SID.ora [oracle@h1 dbhome_2]$ cd /app/oracle/admin/orcl/pfile/ [oracle@h1 pfile]$ ls init.ora.103201271612 [oracle@h1 pfile]$echo $ORACLE_SID orcl #-------------------查看環境變量$ORACLE_SID [oracle@h1 pfile]$ cp init.ora.103201271612 /app/oracle/product/11.2.0/dbhome_2/dbs [oracle@h1 pfile]$ cd /app/oracle/product/11.2.0/dbhome_2/dbs [oracle@h1 dbs]$ mv init.ora.103201271612 initorcl.ora #------------------------------更改名字格式爲:initORACLE_SID.ora
4.mount數據庫
[oracle@h1 dbs]$ sqlplus "/as SYSDBA" SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 4 16:59:09 2012 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> startup mount ORACLE instance started. Total System Global Area 1219260416 bytes Fixed Size 2212856 bytes Variable Size 738200584 bytes Database Buffers 469762048 bytes Redo Buffers 9084928 bytes Database mounted. SQL> SQL> show parameter memory_target; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 1168M SQL> show parameter memory_max_target; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_max_target big integer 1168M SQL> SQL> alter system set memory_max_target=1G scope=spfile; alter system set memory_max_target=1G scope=spfile * ERROR at line 1: ORA-32001: write to SPFILE requested but no SPFILE is in use SQL> show parameter spfile; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string #------------------重建spfile SQL> create spfile from pfile; File created. SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 1219260416 bytes Fixed Size 2212856 bytes Variable Size 738200584 bytes Database Buffers 469762048 bytes Redo Buffers 9084928 bytes Database mounted. Database opened. SQL> show parameter spfile; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string /app/oracle/product/11.2.0/dbh ome_2/dbs/spfileorcl.ora SQL> alter system set memory_max_target=1G scope=spfile; System altered. SQL> alter system set memory_target=1G scope=both; System altered. SQL> alter system set memory_max_target=1332M scope=both; alter system set memory_max_target=1332M scope=both * ERROR at line 1: ORA-02095: specified initialization parameter cannot be modified SQL> alter system set memory_max_target=1332M scope=spfile; System altered. ------------------------------- SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 1402982400 bytes Fixed Size 2213296 bytes Variable Size 922749520 bytes Database Buffers 469762048 bytes Redo Buffers 8257536 bytes Database mounted. Database opened. SQL> show parameter memory_max_target; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_max_target big integer 1344M SQL> show parameter memory_target; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ memory_target big integer 1G SQL> -----------------------finish