05.11.2015 Views

Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 3 ■ FILES 77<br />

• To maintain a history of commented changes. In the past, many DBAs heavily commented<br />

their parameter files with a change history. If they changed the size of the<br />

buffer cache 20 times over the period of a year, for example, they would have 20 comments<br />

in front of the db_cache_size init.ora parameter setting, stating the date <strong>and</strong><br />

reason for making the change. The SPFILE does not support this, but you can achieve<br />

the same effect if you get into the habit of doing the following:<br />

sys@ORA10G> create pfile='init_01_jan_2005_ora10g.ora' from spfile;<br />

File created.<br />

sys@ORA10G> !ls -l $ORACLE_HOME/dbs/init_*<br />

-rw-rw-r-- 1 ora10g ora10g 871 Jan 1 17:04 init_01_jan_2005_ora10g.ora<br />

sys@ORA10G> alter system set pga_aggregate_target=1024m<br />

2 comment = 'changed 01-jan-2005 as per recommendation of George';<br />

In this way, your history will be saved in the series of parameter files over time.<br />

Fixing Corrupted SPFILEs<br />

The last question that comes up with regard to SPFILEs is, “SPFILEs are binary files, so what<br />

happens if one gets corrupted <strong>and</strong> the database won’t start? At least the init.ora file was just<br />

text, so we could edit it <strong>and</strong> fix it.” Well, SPFILEs shouldn’t go corrupt any more than should a<br />

data file, redo log file, control file, <strong>and</strong> so forth. However, in the event that one does, you have<br />

a couple of options.<br />

First, the amount of binary data in the SPFILE is very small. If you are on a UNIX platform,<br />

a simple strings comm<strong>and</strong> will extract all of your settings:<br />

[tkyte@localhost dbs]$ strings spfile$ORACLE_SID.ora<br />

*.compatible='10.1.0.2.0'<br />

*.control_files='/home/ora10g/oradata/ora10g/control01.ctl','/home/ora10g/oradata/or<br />

a10g/control02.ctl','/home/ora10g/oradata/ora10g/control03.ctl'<br />

...<br />

*.user_dump_dest='/home/ora10g/admin/ora10g/udump'<br />

On Windows, simply open the file with write.exe (WordPad). WordPad will display for you<br />

all of the clear text in the file, <strong>and</strong> a simple cut <strong>and</strong> paste into init.ora will allow<br />

you to create a PFILE you can use to start your instance.<br />

In the event that the SPFILE has just “gone missing” (for whatever reason—not that I have<br />

seen an SPFILE disappear), you can also resurrect the information for your parameter file<br />

from the database’s alert log (more information on the alert log shortly). Every time you start<br />

the database, the alert log will contain a section like this:<br />

System parameters with non-default values:<br />

processes = 150<br />

timed_statistics = TRUE<br />

shared_pool_size = 67108864<br />

large_pool_size = 8388608<br />

java_pool_size = 33554432<br />

control_files<br />

= C:\oracle\oradata\ora9ir2w\CONTROL01.CTL,

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!