Create spfile from pfile命令要注意

自从9i版本开始,Oracle数据库开始引进另外一种初始化参数文件,spfile.简单说明一点:①该参数是一个二进制文件,不可以用文本编辑器直接编辑修改;②一般驻留在Database  server端;③对参数的修改在数据库重新启动后仍然生效;④可以通过RMAN工具进行备份。Oracle现在已经不推荐使用PFILE了。数据库在启动的过程当中默认读取参数文件的顺序是:在$ORACLE_HOME/dbs路径下查找并使用名为spfileSID.ora的参数文件启动,次之查找spfile.ora文件,最后才会查找名为initSID.ora的pfile来启动数据库,若这三个文件都没有查到,则数据库在默认情况下就启不来。当然,我们也可以在启动的过程中显示指定使用一个非默认路径下的某个非默认命名的pfile来启动数据库,命令类似于{SQL>startup pfile=/u01/app/…./init.ora}。但是,我们却不可以在启动的过程中显示指定用某个SPFILE来启动数据库!

在这里,我想说明的是:我们在做PFILE与SPFILE互相“倒腾”的过程当中要稍加留意的是,一定要注意参数文件的路径要写全,如果不是利用默认的路径。

例如:我在一次解决问题的过程当中,就犯了一个低级的错误:客户应用环境下当前的SPFILE丢掉了,没有有效地参数文件备份,只有一个不能用的PFILE,实例根本就无法加载了。好在,客户在建数据库的最后一步过程中,保留了脚本。这样,就可以利用该文件来启动数据库了,启动实例之后,我就执行了:SQL>create spfile from pfile;返回结果提示,SPFILE创建成功,然后shutdown,再启动。结果报错,“ORA-03113: 通信通道的文件结束 ORA-01041: 内部错误, hostdef 扩展名不存在”,实例无法启动。我就很诧异了???后来,问题的原因就是执行SQL>create spfile from pfile的时候,没有显示指定pfile=xxxxx,也就是说,利用pfile来创建SPFILE的过程当中,pfile本身就是一个不可以用来启动实例的参数文件,那么利用该文件来创建出来的SPFILE肯定也是一个“废品”文件了。解决问题的方法:重新利用那个脚本中的参数文件启动实例,然后显示的利用该文件来创建一个可用的SPFILE。经过仔细的调整初始化参数,最后数据库有了SPFILE,可以正常启动到OPEN阶段!!!

结论:我们在做参数文件互相转换的过程当中,要谨慎确认,创建文件的源头是不是一个正确的可用的文件。

Send article as PDF to PDF Download

6 comments

  1. banping says:

    捣腾前首先要清楚自己当前的数据库是用什么参数启动的

  2. Tie says:

    Woah that is hard for me to read but thanks for sharing!

  3. Riva Oneill says:

    What a great article. I spend hours on the internet reading blogs, about tons of different subjects. I have to first of all give kudos to whoever created your website and second of all to you for writing what i can only describe as an post. I honestly believe there is a skill to writing articles that only a few posses and frankly you have it. The combination of informative and quality content is definitely extremely rare with the large amount of blogs on the internet.

  4. I recently came across your web site and have been reading along. I thought I would leave my very first comment. Nice blog. I will keep visiting this website very frequently.

  5. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me.

  6. I was looking for crucial information on this subject. The information was important as I am about to launch my own portal. Thanks for providing a missing link in my business.

Leave a Reply

Spam Protection by WP-SpamFree