Pfiles, spfiles and the post-install config of Oracle databases

While in the midst of building a new database for yet another test instance of Oracle’s Identity Manager I had some problems with getting the memory parameters right. This is something we’ve gone through before. On “real” database hardware we’d have 32 Gb (or more) of RAM to play with, but on my test virtual machine the most I can spare is 2 Gb (our hardware maxes out at 4 Gb). After mucking around with it for awhile I succeeded in hosing the db so it wouldn’t start. This was a pain because it had taken two days to get the db built (the process involved installing Oracle 10g from media and then patching up to

The answer to my tale of woe was to overwrite the existing spfile with the initial installed config and then restart the db so it could be reconfigured from there.

The name pfile comes from “ParameterFILE”, because that’s what it is. The name spfile comes from “SystemParameterFILE”. The pfile is in clear text. The spfile is binary. A database can be started using either at the command line. Things are usually set up to start automatically with the spfile if it exists.

To check for the existence of the spfile, do this query:


If it’s there, you’ll get the path and filename.

On my system this was $ORACLE_HOME/dbs. The file is named spfile[SID].ora, or in my case, /u01/app/oracle/product/db/dbs/spfiletest01.ora.

A new spfile can be created (or the old one overwritten) by the info in a pfile.

An initial pfile is usually made during database creation, and located under $OH/admin/[SID]/pfile (in my case /u01/app/oracle/db/admin/testdb/pfile/init.ora.0272009111420).

To create a new spfile, or overwite an existing spfile, from that initial pfile, just do a

SQL> create spfile from pfile;

If you’ve got a pfile from somewhere else, you can use it to create a new spfile, or overwrite an existing one. Just be sure to change any values that need to be specific to the target database.

Here’s the command:

SQL> create spfile from pfile='/tmp/robspfile.ora';

The PATH and file name must be in quotes as above, or the function won’t know what you’re talking about.

To create a pfile from and existing spfile, you would do this:

SQL> create pfile='/tmp/mypfile.ora' from spfile;

So what does a pfile look like? I’m glad you asked. Here’s the one I used to reconfigure my OIM database (hint, hint, this contains a minimal database config for OIM):

*.dispatchers=’(PROTOCOL=TCP) (SERVICE=testdbXDB)’

Those last five lines are the ones that I needed to have set. The others were nls_length_semantics, qurery_rewrite_enabled and query_rewrite_integrity.