spfile and pfile [message #656052] |
Wed, 21 September 2016 08:09 |
|
arifmd1705
Messages: 37 Registered: May 2016 Location: uae
|
Member |
|
|
Hi experts,
I am bit confused about spfile and pfile , as i understand the spfile is a server parameter file which can be used to set any parameters which are of dynamic in nature , meaning which can be done when database is online. For any changes to reflect after changing in pfile we need to restart the database.My doubt is if i change in spile , will those changes be done automatically in pfile.
Changes in spile will reflect in pfile automatically.
Regards
Arif
|
|
|
|
|
Re: spfile and pfile [message #656060 is a reply to message #656052] |
Wed, 21 September 2016 09:41 |
gazzag
Messages: 1119 Registered: November 2010 Location: Bedwas, UK
|
Senior Member |
|
|
You use the PFILEor the SPFILE to start the database. Not both. Preferably the SPFILE.
If you want top see your SPFILE as text, like BlackSwan said:
SQL> CREATE PFILE FROM SPFILE;
What are you trying to achieve?
|
|
|
|
Re: spfile and pfile [message #656062 is a reply to message #656061] |
Wed, 21 September 2016 10:13 |
gazzag
Messages: 1119 Registered: November 2010 Location: Bedwas, UK
|
Senior Member |
|
|
The only way to reflect any changes in SPFILE is to manually create a PFILE from SPFILE. Incidentally, your SPFILE should be included in your backup regime.
|
|
|
|
|
|
|
Re: spfile and pfile [message #656123 is a reply to message #656079] |
Fri, 23 September 2016 08:55 |
|
bpeasland
Messages: 51 Registered: February 2015 Location: United States
|
Member |
|
|
arifmd1705 wrote on Wed, 21 September 2016 23:21i went through the documentation and found out too.Basically we have to manually re-create the PFILE again after changing any parameters in SPFILE.
Not really. I'll give you the history....
A long time ago, there was only the PFILE. The venerable old init.ora as it was lovably known. DBA's put there parameters in this file. Life was easy back then. That is until you needed to change a parameter. Some parameters were modifiable with the system up and running. You could change the parameter value with a simple ALTER SYSTEM command. What was not so simple was that the DBA needed to remember to change the parameter value in the PFILE too otherwise the change would be lost the next time the instance was started. The DBA needed to change things twice.
Oracle decided there was a better way and that was to give us the SPFILE. Now, when you use the ALTER SYSTEM command to change a parameter's value, you can change it in MEMORY, in the SPFILE, or BOTH with the SCOPE clause.
Your database instance only uses one parameter file. One...that's it. Start it up, and it will read one file and then know how to define the parameters. You can explicitly say which parameter file to use by either of the following:
STARTUP PFILE=....
STARTUP SPFILE=...
If you just issue STARTUP, then Oracle will look in $ORACLE_HOME/dbs for the parameter file. It follows this order of precendence:
spfileSID.ora
spfile.ora
initSID.ora
init.ora
Once it finds a file, it quits looking.
If you are making changes to your SPFILE, and you just issue STARTUP, Oracle will never use the PFILE. So you updating the PFILE does nothing but cause extra work for you.
One of the problems with the SPFILE is that it is a binary file and it not readable. So you can't easily see its contents. When I need to see what is set in the SPFILE, I issue the following:
CREATE PFILE='/home/oracle/pfile.txt' FROM SPFILE;
Note that I do not place the PFILE in $ORACLE_HOME/dbs. I purposely avoid putting it there. The only parameter file in my $O_H/dbs is the SPFILE. This helps avoid any confusion down the road.
Another problem with the SPFILE is that you cannot modify it directly which means you need the instance up and running. If you start the instance and the SPFILE has a bad parameter value, then you will need to create a PFILE version, modify that with a text editor, and then create the SPFILE from the PFILE and then you can start the instance.
Oracle prefers us to use the SPFILE and to be honest, every DBA I know with an opinion on the subject will say the same. Use the SPFILE.
You only need one. So remove that PFILE from $ORACLE_HOME/dbs. Its only causing confusion with zero benefit.
Cheers,
Brian
|
|
|
|
|
|
|
Re: spfile and pfile [message #656143 is a reply to message #656127] |
Sat, 24 September 2016 08:49 |
|
EdStevens
Messages: 1376 Registered: September 2013
|
Senior Member |
|
|
Littlefoot wrote on Fri, 23 September 2016 11:40I'm not a DBA. Thank you for explaining it in such a simple manner, I enjoyed reading it.
So, the only drawback (from my point of view) of the whole SPFILE story is that the file is binary. Wouldn't it be simpler if it was a pure txt file, so that you could modify it in case "it has a bad parameter value"? It appears that you still need a PFILE, modify it, (according to best practices) create SPFILE from PFILE, discard PFILE. Hm?
It's pretty rare to get a bad parameter value, such that you would need to create a pfile, fix it, then recreate the spfile. I'm not saying it doesn't happen, but unless one is a complete klutz, it should be pretty rare. There are very few parms for which a bad value would prevent you from at least doing STARTUP NOMOUNT, which is as far as you need to get to ALTER SYSTEM SET ... SCOPE=SPFILE;
|
|
|
|
|