Spfile and Pfile
Spfile and Pfile
SPFILEs:: ---------------------------------------------------------------------------------------------------------->When an Oracle Instance is started, the characteristics of the Instance are e stablished by parameters specified within the initialization parameter file. These initialization parameters are either stored in a PFILE or SPFILE. SPFILEs are available in Oracle 9i and above. All prior releases of Oracle are using PFI LEs. -->SPFILEs provide the following advantages over PFILEs: * An SPFILE can be backed-up with RMAN (RMAN cannot backup PFILEs) * Reduce human errors. The SPFILE is maintained by the server. Parameters ar e checked before changes are accepted. * Eliminate configuration problems (no need to have a local PFILE if you wan t to start Oracle from a remote machine) * Easy to find - stored in a central location
-->Viewing Parameters Settings: One can view parameter values using one of the following methods (regardless if they were set via PFILE or SPFILE): * The "SHOW PARAMETERS" command from SQL*Plus (i.e.: SHOW PARAMETERS timed_s tatistics) * V$PARAMETER view - display the currently in effect parameter values * V$PARAMETER2 view - display the currently in effect parameter values, but "List Values" are shown in multiple rows * V$SPPARAMETER view - display the current contents of the server parameter file. ****************************************************************************** Q)What is the difference between a PFILE and SPFILE: -->A PFILE is a static, client-side text file that must be updated with a standa rd text editor like "notepad" or "vi". This file normally reside on the server, however, you need a local copy if you w ant to start Oracle from a remote machine. DBA's commonly refer to this file as the INIT.ORA file. -->An SPFILE (Server Parameter File), on the other hand, is a persistent serverside binary file that can only be modified with the "ALTER SYSTEM SET" command. This means you no longer need a local copy of the pfile to start the database fr om a remote machine. Editing an SPFILE will corrupt it, and you will not be able to start your database anymore. ******************************************************************************* Q)How will I know if my database is using a PFILE or SPFILE: SQL> show parameter spfile; OR SQL> show parameter pfile;
******************************************************************************** -->Starting a database with a PFILE or SPFILE: Oracle searches for a suitable initialization parameter file in the following or der: * Try to use the spfile${ORACLE_SID}.ora file in $ORACLE_HOME/dbs (Unix) or ORACLE_HOME/database (Windows) * Try to use the spfile.ora file in $ORACLE_HOME/dbs (Unix) or ORACLE_HOME/d atabase (Windows) * Try to use the init${ORACLE_SID}.ora file in $ORACLE_HOME/dbs (Unix) or OR ACLE_HOME/database (Windows) One can override the default location by specifying the PFILE parameter at datab ase startup: SQL> STARTUP PFILE='<path> Note that there is not an equivalent "STARTUP SPFILE=" command. One can only use the above option with SPFILE's if the PFILE you point to (in the example above) , contains a single 'SPFILE=' parameter pointing to the SPFILE that should be us ed. Example: SPFILE=/path/to/spfile ******************************************************************************** * -->Changing SPFILE parameter values: While a PFILE can be edited with any text editor, the SPFILE is a binary file. The "ALTER SYSTEM SET" and "ALTER SYSTEM RESET" commands can be used to change p arameter values in an SPFILE. Look at these examples: SQL> ALTER SYSTEM SET <parametername>=<parametervalue> SCOPE=SPFILE;
-->Converting between PFILES and SPFILES: One can easily migrate from a PFILE to SPFILE or vice versa. Execute the followi ng 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 S PFILE parameters. Look at this example: SQL> CREATE SPFILE='<path>' from PFILE='<path>'; Here is an alternative procedure for changing SPFILE parameter values using the above method: * Export the SPFILE with: CREATE PFILE= pfilename * Edit the resulting PFILE with a text editor FROM SPFILE = spfilename ;
* ename * * PFILE
Shutdown and startup the database with the PFILE option: STARTUP PFILE=fil Recreate the SPFILE with: CREATE SPFILE= spfilename FROM PFILE= pfilename ; On the next startup, use STARTUP without the PFILE parameter and the new S will be used.
http://www.dba-oracle.com/concepts/pfile_spfile.htm