Save a pfile in the same directory where the spfile is located

Posted on 2011-03-02
Last Modified: 2012-05-11
I need to save a pfile in the same directory where the spfile is located, by means of the create pfile from spfile command.
The question is how to extract the directory from the spfile value in v$system_parameter, and then use it in order to create the pfile from spfile in that same directory.
Question by:mordi
  • 2
  • 2
LVL 15

Expert Comment

by:Aaron Shilo
ID: 35016878

show parameter spfile;
select value from v$parameter where name = 'spfile';

Author Comment

ID: 35018981
I forgot to say: it should be done by a script which will be run on more than one instance.
LVL 15

Expert Comment

by:Aaron Shilo
ID: 35019305

create pfile  ='$oracle_home/database/pfileINSTANCENAME.ora' from spfile.

LVL 34

Accepted Solution

johnsone earned 500 total points
ID: 35022213
This query should generate the file name for you:

SELECT Substr(a.VALUE, 1, Instr(a.VALUE, '/', -1))
       || 'init'
       || b.NAME
       || '.ora'
FROM   v$parameter a,
       v$database b
WHERE  a.NAME = 'spfile';

Author Closing Comment

ID: 35055155
Many thanks.
p.d. In windows you search for a backslash instead.

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question