Oracle--spfile and Pfile distinguishes, builds, loads, and fixes ____oracle

Source: Internet
Author: User
Tags naming convention oracle database sqlplus

The Oracle database configuration file refers to files that the system needs to load when booting to the "Nomount" phase, also known as Pfile or SPFile, but Pfile and SPFile are different files.
The different database configuration files are different, but the format is roughly approximate, and the default address is the Databases folder under the Oracle installation directory, for example: "C:\app\Administrator\product\11.2.0\dbhome_1\ Database. "
As mentioned earlier, the configuration file is divided into two kinds, one called pfile, the other is called SPFile, the difference is that SPFile is a binary file, to the machine, Pfile is a text file, to the user to see, but when the Oracle started will only load one of the files, Of course, it is better to load the binary spfile faster.
Although the configuration file is divided into two types, but the configuration in the file, or the file to express the same content, so the two files can be converted to each other, to sysdba identity into the Sqlplus (the following do not make a special statement, the default indicates that the SYSDBA identity has been logged in):
Sqlplus/as Sysdba;
1. First look at the system loaded SPFile information
Show parameter SPFile (or shows parameter pfile, the result is the same)

The name shows that Spfile,value is the loaded SPFile file address, which means that the SPFile file is currently loaded.
SPFILE file naming rule: "SPFILE" +sid. Ora; for example Spfileorcl.ora
Pfile file naming convention: "INIT" + SID. Ora; for example Initorcl.ora
2. Mutual conversion of pfile and SPFile documents
Perhaps most friends found that in the folder where the configuration files, only SPFile, no pfile, My Computer database is just installed 64 Oracle, is not, then want the database to start with a text file, or want to use a text file to view the parameters of the configuration file, But what if you don't have the file? Command Oracle to build a pfile with the configuration of the SPFile file, enter the following command:
Create Pfile from SPFile;
Hint text file has been created.
Viewing the folder again will reveal that the Pfile file already exists
C:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\INITorcl.ORA
3. Let Oracle load Pfile or SPFile
The system defaults to start with a binary file, but some friends like to start with a text file, easy to see real-time parameters. In this note, the system cannot modify which parameter file to start with (personal guess because the parameter file is the first file that is loaded when Oracle starts, if this file can be configured randomly, it will cause failure to start and so on). But oracle on the parameter file has a loading sequence, the priority to find load spfile, can not find the pfile, so we could generate a pfile after the SPFile file deletion, so that the system automatically loaded Pfile, then to execute the spfile command, The result found is empty (the load must be pfile file, the database will not start if no files are loaded)

4. SPFile Loading sequence
Here's a detailed reference to the order in which the configuration files are loaded
1) SPFILE. ORA
2) SPFILE. ORA
3) Init.ora
4) Startup pfile= '
Startup Pfile= ' is a designated Pfile file to start the database, which is supposed to be ranked first, but Oracle in the load, even if the specified pfile file, will still go to find out if there is a pfile file, if there is, load, if there is no To load the specified pfile file.
The first is a file that starts with Pfile, and then the name of the SID, ending with Ora; Then find Spfile.ora This file, if you still do not find the beginning of Init, followed by the SID name, Ora end of the file, these three are not the case to load the specified pfile file, if the specified file is not, then can not start the database.
If you have any of the first three files, and then specify to load a pfile, Oracle also complains and cannot start.

 
5. Fix the configuration file  
What to do if the configuration file is bad and the database doesn't start. There are a number of ways to introduce one of the simplest.  
If broken, lost, completely deleted, backup data also die, all kinds of despair, you can try this, casually find a pfile (must be a text file, easy to modify), the file in the relevant address or data file information, according to the actual database information to make changes, or add the appropriate folder and change the SID in the file to the SID of the actual database, such as these parameters:  
*.control_files= ' C:\app\Administrator\oradata\orcl\ Control01.ctl ', ' C:\app\Administrator\flash_recovery_area\orcl\control02.ctl '  
change to the corresponding controller file in your own project, Then start the database, if the error, based on the save information to remove the extra parameters, until you can start ... &NBSP
As long as the database is started, everything is well discussed. &NBSP
Executes this statement: &NBSP
Create Pfile from memory; ,
generates a spfile file from memory so that the next time you start, you do not need to specify Pfile. &NBSP
6. Replace a parameter   of a file;
If the database cannot be started because of one of the parameters of a spfile file, there is no backup, no pfile, and all kinds of eggs do not hurt. Create a new Ora file with the following contents:  
Spfile=c:\app\administrator\product\11.2.0\dbhome_1\database\11spfileorcl. ora 
Parameter name = parameter value  
Startup pfile= '  
This indicates that the Pfile file was started with the specified and the Pfile file contains C:\app\Administrator\ Product\11.2.0\dbhome_1\database\11spfileorcl. Ora all the data of the file, and there are the following parameters, the next parameter will cover the previous parameters, after a smooth start, to generate a new spfile can be.

If there is a mistake, also hope to point out that common progress; hand knock tired twitch, load note source.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.