Oracle spfile and dbstart

Why won’t my database start when I send the dbstart command?

There is a known bug with the dbstart command on Oracle 9i (and possibly later) servers with databases with server parameter files (spfiles). This bug will cause your database not to start if there is no pfile (initSID.ora) in the default location. You will typically see the error below, followed by the sound of users whining.

bash-2.05$ dbstart

Can't find init file for Database "ORADB".
Database "ORADB" NOT started.

While there are a few options to remedy this, here are my two favorite.

Solution 1: Create a dummy pfile

I like to create a dummy pfile in the default location ($ORACLE_HOME/dbs/init$ORACLE_SID.ora) that contains only the following:

################################################################################
# This database uses an SPFILE to acquire it's parameters for startup.
# The spfile is located at $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora
# This init file is here only as a placeholder so dbstart and dbshut
# work normally. For more info on spfiles see
# http://www.lifeaftercoffee.com/?p=76
# JE 1/6/2005
################################################################################

With this in place (for each database) the dbstart command works normally.

Solution 2: Create a pfile from the spfile

If you connect to the database, running or not, and execute the SQL command CREATE pfile FROM spfile; a pfile will be created in the default location. On startup the pfile will be ignored as long as there is an spfile. This allows dbstart to behave normally and also gives you a backup of the spfile; however this can become confusing and the pfile will not be kept up to date by the database.

For more information on spfiles and pfiles see my article Oracle pfile and spfile for parameters.

oracle, dba, database administration, database

5 thoughts on “Oracle spfile and dbstart”

  1. Easy guys – create a symbolic link as ORACLE to the spfile – and it works!

    $ cd /u01/app/oracle/product/9.2.0/dbs
    $ ln -s spfileSID.ora initSID.ora

    As ROOT:
    su – oracle -c /u01/app/oracle/product/9.2.0/bin/dbstart

  2. Marius,

    While that method may work I would not recommend it. The pfile and spfile are in different formats and beyond Oracle screwing up your spfile, if another DBA sees initSID.ora they will think it’s a normal pfile and manually edit it. That means certian death for your spfile.

    If you’re relaly lazy you could just create a blank one with the command:

    $ touch spfile

    but I would not recommend linking it to your spfile.

  3. Another possibility is to correct the ${ORACLE_HOME}/bin/dbstart and ${ORACLE_HOME}/bin/dbstart file.

    simply change the line
    PFILE=${ORACLE_HOME}/dbs/init${ORACLE_SID}.ora

    to
    PFILE=${ORACLE_HOME}/dbs/spfile${ORACLE_SID}.ora

  4. Nasseem,

    I’m sure that works, but you’re running the same risks as Marius. The spfile and init file just aren’t the same. You also have the problem of having to reapply this change if an upgrade overwrites dbstart and dbshut.

  5. Why do people constantly try to do something just a little bit better? IMHO, the article presents the best solution (period).

    -Bob
    8i/9i/10g OCM DBA

Leave a Reply

Your email address will not be published. Required fields are marked *