【转】oracle pfile和spfile小结

上一篇 / 下一篇  2012-04-18 13:02:25 / 个人分类:数据库

1、pfile 文本文件 client端参数文件;不能动态修改,可以用普通的编辑器修改,修改之后需要重启。pfile可能会导致服务器启动不一致,因为可以在客户端启动。 2、spfile 二进制文件服务器端参数文件,有了spfile,oracle可以实现动态参数在线修改,部分参数修改之后无需重启。但是,因为是二进制文件,所以不能用 普通的编辑器修改,要用alter命令从sql里面来修改。spfile保证服务器每次的启动都是一致的。只有spfile而没有pfile文件时,可以 通过: create pfile='位置+名字' from spfile; 如: create pfile='E:/ORACLE/PRODUCT/10.2.0/DB_1/DBS/spfileorcl_bak.ora' from spfile; 进行创建pfile文件。 同理,只有pfile而没有spfile时,可以通过: create spfile='位置+名字' from pfile; 进行创建spfile文件。pfile和spfile二者可以互相备份。 3、通过spfile或pfile启动数据库: (1)startup nomount启动方式,查找文件的顺序是 spfileSID.ora-〉spfile.ora-〉initSID.ora-〉init.ora(spfile优先于pfile)。 (2)startup pfile='文件目录'----通过pfile文件启动;(3)startup spfile='文件目录'----通过spfile文件启动。 以下转自: http://www.cnblogs.com/jacktu/archive/2008/02/27/1083232.html 查看系统是以pfile还是spfile启动 Select isspecified,count(*) from v$spparameter group by isspecified; 如果isspecified里有true,表明用spfile进行了指定配置 如果全为false,则表明用pfile启动 使用SPfile的好处 Spfile改正了pfile管理混乱的问题,在多结点的环境里,pfile会有多个image 启动时候需要跟踪最新的image。这是个烦琐的过程。 用spfile以后,所有参数改变都写到spfile里面(只要定义scope=spfile或both),参数配置有个权威的来源。 查看spfile location show parameter spfile 从spfile获取pfile Create pfile='d:pfileSID.ora' from spfile; Create pfile='d:pfileSID.ora' from spfile='spfile_location'; 从pfile获取spfile Create spfile from pfile='Your_pfile_location' Create spfile='spfile_location' from pfile='Your_pfile_location' 动态修改参数 alter system set parameter=Value scope=spfile|both|memory Startup nomount的时候需要读去spfile或pfile,两者共存,spfile优先 强制用pfile启动 SQL>startup pfile='Your_Pfile.ora' startup spfile='/data/oracle/product/10.2.0/db_1/dbs/dbs/spfile_mqq.ora' force 通过pfile连接到spfile启动 修改pfile文件

 

oracle pfile spfiel 总结
2008-08-17 11:43

   ORACLE SPFILE PFILE 总结

OSLinux localhost.localdomain 2.4.21-20.EL #1 Wed Aug 18 20:58:25 EDT 2004 i686 i686 i386 GNU/Linux

ORACLE:
SQL> select*from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Release 9.2.0.4.0 - Production
PL/SQL Release 9.2.0.4.0 - Production
CORE    9.2.0.3.0       Production
TNS for Linux: Version 9.2.0.4.0 - Production
NLSRTL Version 9.2.0.4.0 - Production


1。指定PFILE的路径:
CREATE SPFILE FROM PFILE='初始化变量文件的全路径';

CREATE SPFILE [= '<spfile_name>;'] FROM PFILE [= '<pfile_name>;'];

The above will create a Server Parameter file (SPFILE) based on the existing
Parameter File (PFILE) (INIT<ORACLE_SID>;.ORA).
The SPFILE is by default named SPFILE<ORACLE_SID>;.ORA and placed in the default (port specific) directory.

If existing PFILE (INIT<ORACLE_SID>;.ORA) is not in default directory and using default naming,
the below must be specified:
CREATE SPFILE FROM PFILE='<directory-and-filename>;' ;

SQL> create spfile='/opt/oracle/admin/boco/pfile/spfileorcl.ora' from pfile='/opt/oracle/admin/boco/pfile/initorcl.ora.716200815553';

   File created.

   SQL> show parameter process;

   NAME                                 TYPE        VALUE
   ------------------------------------ ----------- ------------------------------
   aq_tm_processes                      integer     1
   db_writer_processes                  integer     1
   job_queue_processes                  integer     10
   log_archive_max_processes            integer     2
   processes                            integer     50
   SQL> shutdown immediate;
   Database closed.
   Database dismounted.
   ORACLE instance shut down.
   SQL> startup
   ORACLE instance started.

   Total System Global Area 236000356 bytes
   Fixed Size                   451684 bytes
   Variable Size             201326592 bytes
   Database Buffers           33554432 bytes
   Redo Buffers                 667648 bytes
   Database mounted.
   Database opened.
   SQL> show parameter process;

   NAME                                 TYPE        VALUE
   ------------------------------------ ----------- ------------------------------
   aq_tm_processes                      integer     1
   db_writer_processes                  integer     1
   job_queue_processes                  integer     10
   log_archive_max_processes            integer     2
   processes                            integer     150
   SQL> create spfile from pfile='/opt/oracle/admin/boco/pfile/initorcl.ora.716200815553'
    2 ;
   create spfile from pfile='/opt/oracle/admin/boco/pfile/initorcl.ora.716200815553'
   *
   ERROR at line 1:
   ORA-32002: cannot create SPFILE already being used by the instance


   SQL> shutdown immediate
   Database closed.
   Database dismounted.
   ORACLE instance shut down.
   SQL> startup pfile='/opt/oracle/admin/boco/pfile/initorcl.ora.716200815553';
   ORACLE instance started.

   Total System Global Area 236000356 bytes
   Fixed Size                   451684 bytes
   Variable Size             201326592 bytes
   Database Buffers           33554432 bytes
   Redo Buffers                 667648 bytes
   Database mounted.
   Database opened.
   SQL> create spfile from pfile='/opt/oracle/admin/boco/pfile/initorcl.ora.716200815553'
    2 ;

   File created.


3.在pfile中可以指定引用spfile,
启动时会先用pfile指定的参数,然后如果spfile中有相同的参数覆盖pfile中的参数
你可以在pfile中指定引用spfile
如,你可以在pfile中加入如下一行:

spfile='/opt/oracle/dbs/spfile<sid>.ora'

4.查看当前数据库是pfile还是spfile启动
oracle在默认情况下以spfile启动,除非你启动时指定pfile
如:startup pfile=/opt/oracle/admin/boco/pfile/initorcl.ora

show parameter spfile;如果是不为空,会告诉你spfile的文件路径,说明是以spfile启动。如下面例子

SQL> startup pfile=/opt/oracle/admin/boco/pfile/initorcl.ora.716200815553
   ORACLE instance started.

   Total System Global Area 236000356 bytes
   Fixed Size                   451684 bytes
   Variable Size             201326592 bytes
   Database Buffers           33554432 bytes
   Redo Buffers                 667648 bytes
   Database mounted.
   Database opened.
   SQL> show parameter process;

   NAME                                 TYPE        VALUE
   ------------------------------------ ----------- ------------------------------
   aq_tm_processes                      integer     1
   db_writer_processes                  integer     1
   job_queue_processes                  integer     10
   log_archive_max_processes            integer     2
   processes                            integer     50
   SQL> show parameter spfile;

   NAME                                 TYPE        VALUE
   ------------------------------------ ----------- ------------------------------
   spfile                               string
   SQL> show parameter pfile;

   NAME                                 TYPE        VALUE
   ------------------------------------ ----------- ------------------------------
   spfile                               string


TAG:

 

评分:0

我来说两句

Open Toolbar