Thursday, July 2, 2009

While startup ORA-27046: file size is not a multiple of logical block size

Problem Description
While creating pfile from your spfile you got the following ORA-27046. Though the error message that it shows depends on oracle version.

In Oracle 11g the error message look like,

SQL> create pfile from spfile;
create pfile from spfile
*
ERROR at line 1:
ORA-01565: error in identifying file
'%ORACLE_HOME%\DATABASE\SPFILE%ORACLE_SID%.ORA'
ORA-27046: file size is not a multiple of logical block size
OSD-04012: file size mismatch (OS 911)

In Oracle 10g the error message looks like,

SQL> create pfile from spfile;
create pfile from spfile
*
ERROR at line 1:
ORA-27046: file size is not a multiple of logical block size
OSD-04012: file size mismatch (OS 3583)

In Oracle 9.2 the error message looks like,
SQL> create pfile='init.ora' from spfile='/oracle/oradata/product/spfileprod.ora';

create pfile='init.ora' from spfile='/oracle/oradata/product/spfileprod.ora'
*
ERROR at line 1:
ORA-27046: file size is not a multiple of logical block size
Additional information: 1
Additional information: 254

Cause of the Problem
Oracle database finds a spfile in the desired location but it was not able to read the file as the server parameter file was corrupted. If you try to create a pfile from a corrupted spfile then ORA-27046 error occurs. In the same way, if your database spfile with it's default name, found in default location which refer on windows under %ORACLE_HOME%\database, on unix under $ORACLE_HOME/dbs and your spfile is corrupted and then if you issue startup Oracle can report a ORA-1078.

Solution of the problem
It is simple to understand that there is no way the spfile can be repaired or modified manually because spfile is a binary file. To know more about spfile have a look at Pfile and Spfile in Oracle.

So now the solution is to restore a spfile from backup, or recreate a new spfile.

If a SPFILE backup exists, restore it to the original location. The backup could be a copy of the spfile or from a RMAN backup. How you can restore it from RMAN is discussed in Restore SPfile from RMAN and Restore an Spfile from Autobackup.

However if the spfile backup does not exist, one can use an existing pfile or the list of non-default parameters listed in the alert log at startup time, or one can also get the parameters from the corrupted spfile using utilities like strings available on unix, similar utilities can be found for Windows as well. On windows you can simply open the file using notepad ++ or ultra edit and copy readable part of the corrupted spfile and save it as a pfile.

After that using the SQL command CREATE SPFILE FROM PFILE create a spfile from the pfile.

A detail about the procedure is discussed inside solution part of the post
Different ways to discover spfile.

In unix simply,
$ strings spfile$ORACLE_SID.ora init$ORACLE_SID.ora

where $ORACLE_SID will be replaced by your oracle sid.

SQL> conn / as sysdba

SQL> create spfile from pfile ;


Will create a good spfile.

After you create spfile now you are done. You can startup your database as well as you can create as many pfile from spfile as you wish.
Related Documents

No comments:

Post a Comment