Posts Tagged ‘SPFILE’

How to change SPFILE parameters for the Oracle RAC database.

2011-12-20 1 comment

Well, this is a quite simple task as it sounds. But believe me when I was supposed to do this for the first time in my career I had a hard time searching for exact solution. There are at least two known methods available to perform this task.

Method 1.
Simply issue the following SQL statement from any of the nodes:

ALTER SYSTEM SET parameter_name=parameter_value SCOPE=SPFILE;

There are 3 possible values for the ‘SCOPE’ clause in this statement:
1. MEMORY – the change is immediate but will not be available after next startup or reboot of the instance
2. SPFILE – the change will be effective in SPFILE only and will be available after next startup or reboot of the instance
3. BOTH – the change is effective for both MEMORY and SPFILE and will be available after next startup or reboot of the instance also
Default is BOTH.
You could also specify another clause called ‘SID’ at the end of the above ALTER statement which is specifically meant for a RAC database. This is to specify the instance where you want to make that change.
For example:

ALTER SYSTEM SET parameter_name=parameter_value SCOPE=SPFILE SID='*';

means that this particular change in the parameter will happen on all instances after rebooting them, default is ‘*’.

Method 2.
Another method to change a parameter in the spfile is to export it to a pfile, change it and then create a new spfile. Let me detail out the various steps involved.
1. On one instance, create a pfile from the existing spfile:


This will create a pfile called initSID.ora at $ORACLE_HOME\database
2. Edit the resulting pfile initSID.ora in a text editor (add/alter the required parameter). You should use ‘*’, so that this parameter value is applied to all instances.
3. Now shutdown all the instances.
4. Startup the instance (and hence the database) where you created and altered the pfile using this pfile only:


Do not start other instances yet.
5. Now through this instance only, create a new spfile (which can be at a common location being accesses by all instances)

CREATE SPFILE='commom_location\spfile.ora' FROM PFILE='$ORACLE_HOME\database\initSID.ora';

This will overwrite the existing spfile with the spfile which has the new/altered parameter.
6. Now shutdown this instance again.
7. Now startup normally all the other instances without PFILE or SPFILE option:


By default startup will now consider the new spfile.
8. To confirm that the new parameters have been set/removed, issue following sql statement from all instances:


This method would not be much different if this is a single instance database instead of a RAC database (in step #7 you would be starting only that single instance).
That’s should be all.