在Oracle关闭情况下如何修改spfile的参数
发现问题
我使用的Oracle11g,当我敲下如下一段命令后,就让我傻眼了。。
altersystemsetsga_max_size=960Mscope=spfile; shutdownimmediate startup
此时的startup报错了,错误为:
SQL>startup ORA-00844:ParameternottakingMEMORY_TARGETintoaccount ORA-00851:SGA_MAX_SIZE985661440cannotbesettomorethanMEMORY_TARGET784334848.
原因分析
原来在Oracle11g中增加了memory_target参数,sga_max_size必须比memory_target参数小。那么问题来了,此时我已经关闭Oracle了,spfile文件是二进制文件,又不能手动修改,那么我该怎么办呢。。好捉急好捉急。。。
解决思路
通过pfile启动Oracle–>在Oracle中通过createpfile=''fromspfile=''取出spfile的内容(pfile是可以手动修改的)–>修改新建的pfile–>以新的pfile启动Oracle–>在Oracle中通过createspfile=''frompfile=''获得修改后的spfile
实战
[oracle@wing~]$sqlplus/assysdba SQL*Plus:Release11.2.0.4.0ProductiononMonFeb1514:04:462016 Copyright(c)1982,2013,Oracle.Allrightsreserved. Connectedtoanidleinstance. SQL>createpfile='/home/oracle/pfile.new'fromspfile='/u01/app/oracle/product/11.2.0/db_1/dbs/spfilewingdb.ora'; Filecreated. SQL>exit DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction WiththePartitioning,OLAP,DataMiningandRealApplicationTestingoptions 通过vi修改pfile.new文件中相应的参数(本文档中是memory_target参数),修改后保存 [oracle@wing~]$sqlplus/assysdba SQL*Plus:Release11.2.0.4.0ProductiononMonFeb1514:04:462016 Copyright(c)1982,2013,Oracle.Allrightsreserved. Connectedtoanidleinstance. SQL>startuppfile='/home/oracle/pfile.new' ORACLEinstancestarted. TotalSystemGlobalArea810090496bytes FixedSize2257520bytes VariableSize415239568bytes DatabaseBuffers390070272bytes RedoBuffers2523136bytes Databasemounted. Databaseopened. SQL>createspfile='/u01/app/oracle/product/11.2.0/db_1/dbsspfilewingdb.ora'frompfile='/home/oracle/pfile.new'; Filecreated. SQL>shutdownimmediate Databaseclosed. Databasedismounted. ORACLEinstanceshutdown. SQL>exit DisconnectedfromOracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProduction WiththePartitioning,OLAP,DataMiningandRealApplicationTestingoptions [oracle@wing~]$sqlplus/assysdba SQL*Plus:Release11.2.0.4.0ProductiononMonFeb1514:08:402016 Copyright(c)1982,2013,Oracle.Allrightsreserved. Connectedtoanidleinstance. SQL> SQL>startup ORACLEinstancestarted. TotalSystemGlobalArea810090496bytes FixedSize2257520bytes VariableSize415239568bytes DatabaseBuffers390070272bytes RedoBuffers2523136bytes Databasemounted. Databaseopened. SQL>showparametermemory NAMETYPE -------------------------------------------------------------------- VALUE ------------------------------ hi_shared_memory_addressinteger 0 memory_max_targetbiginteger 800M memory_targetbiginteger 800M shared_memory_addressinteger 0 SQL>showparametersga NAMETYPE -------------------------------------------------------------------- VALUE ------------------------------ lock_sgaboolean FALSE pre_page_sgaboolean FALSE sga_max_sizebiginteger 776M sga_targetbiginteger 740M #至此Oracle使用新的spfile启动成功,参数也得到相应的修改
总结
以上就是关于如何在Oracle关闭的情况下修改spfile里面参数的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。