Pages

Sunday, February 27, 2011

Using SPFile

SQL> create spfile from pfile='E:\oracle\product\10.2.0\admin\DUPDB\initDUPDB.ora';

File created.

SQL> shutdown immediate;
ORA-01507: database not mounted



ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area  612368384 bytes
Fixed Size                  1250452 bytes
Variable Size             167775084 bytes
Database Buffers          440401920 bytes
Redo Buffers                2940928 bytes
SQL>

How will I know if my database is using a PFILE or SPFILE:
SELECT DECODE(value, NULL, 'PFILE', 'SPFILE') "Init File Type" 
       FROM sys.v_$parameter WHERE name = 'spfile';
 Converting between PFILES and SPFILES:
One can easily migrate from a PFILE to SPFILE or vice versa. Execute the following commands from a user with SYSDBA or SYSOPER privileges:

SQL> CREATE PFILE FROM SPFILE; 
SQL> CREATE SPFILE FROM PFILE;
 
One can also specify a non-default location for either (or both) the PFILE and SPFILE parameters. Look at this example:
SQL> CREATE SPFILE='/oradata/spfileORCL.ora' from PFILE='/oradata/initORCL.ora';

Here is an alternative procedure for changing SPFILE parameter values using the above method:
  • Export the SPFILE with: CREATE PFILE=‘pfilename’ FROM SPFILE = ‘spfilename’;
  • Edit the resulting PFILE with a text editor
  • Shutdown and startup the database with the PFILE option: STARTUP PFILE=filename
  • Recreate the SPFILE with: CREATE SPFILE=‘spfilename’ FROM PFILE=‘pfilename’;
  • On the next startup, use STARTUP without the PFILE parameter and the new SPFILE will be used.
Parameter File Backups:
RMAN (Oracle's Recovery Manager) will backup the SPFILE with the database control file if setting "CONFIGURE CONTROLFILE AUTOBACKUP" is ON (the default is OFF). PFILEs cannot be backed-up with RMAN. Look at this example:
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
Use the following RMAN command to restore an SPFILE:
RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;

 
 

No comments:

Post a Comment