欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

在Oracle关闭情况下如何修改spfile的参数

程序员文章站 2023-02-22 12:31:08
发现问题 我使用的oracle11g,当我敲下如下一段命令后,就让我傻眼了。。 alter system set sga_max_size=960m sco...

发现问题

我使用的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里面参数的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流。