程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> 關於Oracle數據庫 >> 在Oracle關閉情況下如何修改spfile的參數

在Oracle關閉情況下如何修改spfile的參數

編輯:關於Oracle數據庫

發現問題

我使用的Oracle11g,當我敲下如下一段命令後,就讓我傻眼了。。

alter system set sga_max_size=960M scope=spfile;
shutdown immediate
startup

此時的startup報錯了,錯誤為:

SQL> startup
ORA-00844: Parameter not taking MEMORY_TARGET into account
ORA-00851: SGA_MAX_SIZE 985661440 cannot be set to more than MEMORY_TARGET 784334848.

原因分析

原來在Oracle11g中增加了memory_target參數,sga_max_size必須比memory_target參數小。那麼問題來了,此時我已經關閉Oracle了,spfile文件是二進制文件,又不能手動修改,那麼我該怎麼辦呢。。好捉急好捉急。。。

解決思路

通過pfile啟動Oracle–>在Oracle中通過create pfile='' from spfile=''取出spfile的內容(pfile是可以手動修改的)–>修改新建的pfile–>以新的pfile啟動Oracle–>在Oracle中通過create spfile='' from pfile=''獲得修改後的spfile

實戰

[oracle@wing ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Feb 15 14:04:46 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create pfile='/home/oracle/pfile.new' from spfile='/u01/app/oracle/product/11.2.0/db_1/dbs/spfilewingdb.ora';
File created.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
通過vi修改pfile.new文件中相應的參數(本文檔中是memory_target參數),修改後保存 
[oracle@wing ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Feb 15 14:04:46 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup pfile='/home/oracle/pfile.new'
ORACLE instance started.
Total System Global Area 810090496 bytes
Fixed Size     2257520 bytes
Variable Size    415239568 bytes
Database Buffers   390070272 bytes
Redo Buffers    2523136 bytes
Database mounted.
Database opened.
SQL> create spfile='/u01/app/oracle/product/11.2.0/db_1/dbsspfilewingdb.ora' from pfile='/home/oracle/pfile.new';
File created.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@wing ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Feb 15 14:08:40 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> 
SQL> startup
ORACLE instance started.
Total System Global Area 810090496 bytes
Fixed Size     2257520 bytes
Variable Size    415239568 bytes
Database Buffers   390070272 bytes
Redo Buffers    2523136 bytes
Database mounted.
Database opened.
SQL> show parameter memory 
NAME         TYPE
------------------------------------ --------------------------------
VALUE
------------------------------
hi_shared_memory_address    integer
0
memory_max_target     big integer
800M
memory_target      big integer
800M
shared_memory_address    integer
0
SQL> show parameter sga
NAME         TYPE
------------------------------------ --------------------------------
VALUE
------------------------------
lock_sga        boolean
FALSE
pre_page_sga       boolean
FALSE
sga_max_size       big integer
776M
sga_target       big integer
740M
# 至此Oracle使用新的spfile啟動成功,參數也得到相應的修改

總結

以上就是關於如何在Oracle關閉的情況下修改spfile裡面參數的全部內容了,希望本文的內容對大家的學習或者工作能帶來一定的幫助,如果有疑問大家可以留言交流。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved