Do not use the pfile init.ora as it is to old for us. we can copy from expert. if we use the dbca to setup the db, it will create one pfile ans spfile automaticlly.
-----------------------------------------------------
# 1. copy the init.ora and then modify the pfile.
 cp init.ora /u01/oracle/dbs/initalex.ora
vi
db_name = alex
db_block_size = 8192 (add this row)
control_file ....

# 2. try to use this pfile to start up the database
conn / as sysdba
startup
error: ORA-00402    .... #if we edit the init.ora to the new one, we still we meet error, we should get it from expert.

shutdown abort
quit
-----------------------------------------------------

Pfile 可以存在客户端,每个用户如果以远端登录到服务器端, 默认会去找本机中的Pfile作为初始化文件.
而Spfile则只能存在于服务器端,这也是Spfile提出的原因.这个文件是oracle 自动进行维护.RMAN进行备份的时候只能备份Spfile.

--------------------------------------------
#创建Spfile
CREATE SPFILE ='$ORACLE_HOME/dbs/spfileDBA01.ora' FROM PFILE = '..../initDBA01.ora'
#查看 spfile 内容
strings spfile | more
#打开后我们可以看到前面有*. 这样的字符,这个*指的是实例名,如果是在RAC中,如果有两个实例Alex1, Alex2,那么*. 就变成Alex1. 和Alex2.
#修改Spfile里面的内容
Alter system set parameter=value <comment='text'><deferred><scope=memory|spfile|both(缺省)><sid='sid|*'>
Alter system reset ....
SELECT name,value,update_comment  FROM v$parameter
---------------------------------------------

---------------------------------------------
#通过Pfile 创建Spfile
CREATE PFILE =' ...' FROM SPFILE = '....';
---------------------------------------------

Spfile is better than PFILE


当STARTUP 的时候, 按以下顺序来查找spfile  和pfile
-spfileSID.ora
-Default SPFILE -> spfile.ora
-initSID.ora
-Default PFILE -> ???

也可以在起动的时候来指定Pfile的指定
STARTUP PFILE = ..../initDBA1.ora
但是STARTUP命令不能指定SPFILE, 得通过创建一个pfle然后在这个里面添加一句 SPFILE = '...../spfileDBA1.ora'  ,这样在起动的时候,通过起动pfile,就可以定位到spfile .



posted on 2008-06-30 11:58  Alex.Zhang  阅读(271)  评论(0编辑  收藏  举报