Starting from Oracle 9i, Oracle uses spfile by default to start the database. spfile must be created by pfile. The new spfile will take effect the next time the database is started.
Pfile is the Initialization parameter file (Initialization Parameters Files). Before Oracle 9i, Oracle stores the Initialization Parameters through pfile. The file is a text file and can be manually modified.
Spfile is the Server Parameters Files, which is introduced after Oracle 9i. It is a data file and cannot be modified manually.
Before Oracle9i, you must manually modify the pfile file to modify the initialization parameters. When the instance is started, the initialization parameters will be read from the pfile. Therefore, restarting the instance will make the modification take effect. After spfile is introduced, you can directly use the command to modify the parameter (alter system). The dynamic parameter modification can take effect directly and the scope of the parameter can be set at the same time, the scope of the static parameter must be spfile, which takes effect only after restart.
- [Oracle @ oracle pfile] $ file init. ora.7302011151541
- Init. ora.7302011151541: ASCII text
- [Oracle @ oracle dbs] $ file spfileTESTDB. ora
- SpfileTESTDB. ora: data
[oracle@oracle dbs]$ file spfileTESTDB.ora spfileTESTDB.ora: data
- SQL> select * from v $ version;
- BANNER
- --------------------------------------------------------------------------------
- Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-64bi
- PL/SQL Release 10.2.0.1.0-Production
- CORE 10.2.0.1.0 Production
- TNS for Linux: Version 10.2.0.1.0-Production
- NLSRTL Version 10.2.0.1.0-Production
The file directories are:
Pfile:
/Home/oracle/admin/TESTDB/pfile/init. ora.6112012111012
Spfile:
/Home/oracle/product/10.2.0/db_1/dbs/spfileTESTDB. ora
1. If the spfile is corrupted and does not exist, restart the database and the spfile cannot be found.
- SQL> startup
- ORA-01078: failure in processing system parameters
- LRM-00109: cocould not open parameter file
- '/Home/oracle/product/10.2.0/db_1/dbs/initTESTDB. ora'
In this case, you need to create a spfile through pfile (note that the spfile file cannot be re-created while the system is running normally, this method can also be used to check whether the database is started through the spfile file --!) :
- ERROR at line 1:
- ORA-32002: cannot create SPFILE already being used by the instance
- SQL> create spfile from pfile =
- '/Home/oracle/admin/TESTDB/pfile/init. ora.7302011151541 ';
- File created.
And restart the database.
By default, spfile is created to the default directory of the system.
- Unix: $ ORACLE_HOME/dbs
- Windows: $ ORACLE_HOME \ database
Note:
1. Create a pfile through the spfile File
Create pfile [= 'pfile-name'] from spfile [= 'spfile-name'];
2. Create a spfile file through the pfile File
Create spfile [= 'spfile-name'] from pfile [= 'pfile-name'];
3. Modify dynamic parameters through the spfile File
Alter system set parameter = Value scope = memory | spfile | both
Memory: only changes the current instance and becomes invalid after the database is restarted.
Spfile: only changes the spfile settings, does not change the current instance settings, takes effect after the database is restarted
Both: changes the spfile and instance settings at the same time. The current change takes effect immediately and remains valid after restart.
4. When you start up nomount, you need to read spfile or pfile to coexist. spfile takes precedence.