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

rekharaghuram
from rekharaghuram More from this publisher
05.11.2015 Views

CHAPTER 3 ■ FILES 67 Without a parameter file, you cannot start an Oracle database. This makes the parameter file fairly important, and as of Oracle9i Release 2 (versions 9.2 and above), the backup and recovery tool Recovery Manager (RMAN) recognizes this file’s importance and will allow you to include the server parameter file (but not the legacy init.ora parameter file type) in your backup set. However, since it is simply a plain text file, which you can create with any text editor, it is not a file you have to necessarily guard with your life. You can re-create it, as long as you know what was in it (e.g., you can retrieve that information from the database’s alert log, if you have access to that). We will now examine each type of parameter file (init.ora and SPFILE) in turn, but before we do that, let’s see what a database parameter file looks like. What Are Parameters? In simple terms, a database parameter may be thought of as a “key” and “value” pair. You saw an important parameter, DB_NAME, in the preceding chapter. The DB_NAME parameter was stored simply as db_name = ora10g. The “key” here is DB_NAME and the “value” is ora10g—that is our key/value pair. In order to see the current value of an instance parameter, you can query the V$ view V$PARAMETER. Alternatively, in SQL*Plus you can use the SHOW PARAMETER command, for example: sys@ORA10G> select value 2 from v$parameter 3 where name = 'pga_aggregate_target'; VALUE ------------------------------------------------------------------------------- 1073741824 sys@ORA10G> show parameter pga_agg NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ pga_aggregate_target big integer 1G Both outputs show basically the same information, although you can get more information from V$PARAMETER (there are many more columns to choose from than displayed in this example). But SHOW PARAMETER wins for me in ease of use and the fact that it “wildcards” automatically. Notice that I typed in only pga_agg; SHOW PARAMETER adds % to the front and back. ■Note All V$ views and all dictionary views are fully documented in the Oracle Database Reference manual. Please regard that manual as the definitive source of what is available in a given view. If you counted the number of documented parameters that you may set in each of the database versions 9.0.1, 9.2.0, and 10.1.0, you would probably find 251, 258, and 255 different parameters, respectively (I’m sure there could be additional parameters available on an

68 CHAPTER 3 ■ FILES operating system–by–operating system basis). In other words, the number of parameters (and their names) varies by release. Most parameters, like DB_BLOCK_SIZE, are very long lived (they won’t go away from release to release), but over time many other parameters become obsolete as implementations change. For example, in Oracle 9.0.1 there was a DISTRIBUTED_TRANSACTIONS parameter that could be set to some positive integer and that controlled the number of concurrent distributed transactions the database could perform. It was available in prior releases, but it is not found in any release subsequent to 9.0.1 and, in fact, attempting to use it with subsequent releases will raise an error: ops$tkyte@ORA10G> alter system set distributed_transactions = 10; alter system set distributed_transactions = 10 * ERROR at line 1: ORA-25138: DISTRIBUTED_TRANSACTIONS initialization parameter has been made obsolete If you would like to review these parameters and get a feeling for what is available and what each parameter does, you should refer to the Oracle Database Reference manual. The first chapter of this manual examines each and every documented parameter in detail. I would like to point out that in general, the default value assigned to these parameters (or the derived value for parameters that obtain their default settings from other parameters) is sufficient for most systems. In general, the values of parameters, such as the CONTROL_FILES parameter (which specifies the location of the control files on your system), DB_BLOCK_SIZE, and various memory-related parameters, need to be set uniquely for each database Notice I used the term “documented” in the preceding paragraph. There are undocumented parameters as well. You can identify these by the fact that their names begin with an underscore (_). There is a great deal of speculation about these parameters. Since they are undocumented, some people believe they must be “magical,” and many people assume that they are well known and used by Oracle “insiders.” In fact, I find the opposite to be true. They are not well known and they are hardly ever used. Most of these undocumented parameters are rather boring, actually, as they represent deprecated functionality and backwardcompatibility flags. Others help in the recovery of data, not of the database itself; for example, some of them enable the database to start up in certain extreme circumstances, but only long enough to get data out. You have to rebuild after that. Unless you are so directed by Oracle Support, there is no reason to have an undocumented parameter in your configuration. Many have side effects that could be devastating. In my development database, I use only one undocumented setting, if any: _TRACE_FILES_PUBLIC = TRUE This parameter makes trace files readable by all, not just the DBA group. On my development database, I want my developers to use SQL_TRACE, TIMED_STATISTICS, and the TKPROF utility frequently (well, I demand it actually); hence they need to be able to read the trace files. With the advent of external tables in Oracle 9.0.1 and above, we’ll see that we need not use even this parameter to permit access to trace files. In my production database, I don’t use any undocumented settings. In fact, the seemingly “safe” undocumented parameter just mentioned can have undesirable side effects in a live system. Think about the sensitive information that you might find in a trace file, such as SQL

68<br />

CHAPTER 3 ■ FILES<br />

operating system–by–operating system basis). In other words, the number of parameters (<strong>and</strong><br />

their names) varies by release. Most parameters, like DB_BLOCK_SIZE, are very long lived (they<br />

won’t go away from release to release), but over time many other parameters become obsolete<br />

as implementations change.<br />

For example, in <strong>Oracle</strong> 9.0.1 there was a DISTRIBUTED_TRANSACTIONS parameter that could<br />

be set to some positive integer <strong>and</strong> that controlled the number of concurrent distributed<br />

transactions the database could perform. It was available in prior releases, but it is not found<br />

in any release subsequent to 9.0.1 <strong>and</strong>, in fact, attempting to use it with subsequent releases<br />

will raise an error:<br />

ops$tkyte@ORA10G> alter system set distributed_transactions = 10;<br />

alter system set distributed_transactions = 10<br />

*<br />

ERROR at line 1:<br />

ORA-25138: DISTRIBUTED_TRANSACTIONS initialization parameter has been made<br />

obsolete<br />

If you would like to review these parameters <strong>and</strong> get a feeling for what is available <strong>and</strong><br />

what each parameter does, you should refer to the <strong>Oracle</strong> <strong>Database</strong> Reference manual. The first<br />

chapter of this manual examines each <strong>and</strong> every documented parameter in detail. I would like<br />

to point out that in general, the default value assigned to these parameters (or the derived<br />

value for parameters that obtain their default settings from other parameters) is sufficient for<br />

most systems. In general, the values of parameters, such as the CONTROL_FILES parameter<br />

(which specifies the location of the control files on your system), DB_BLOCK_SIZE, <strong>and</strong> various<br />

memory-related parameters, need to be set uniquely for each database<br />

Notice I used the term “documented” in the preceding paragraph. There are undocumented<br />

parameters as well. You can identify these by the fact that their names begin with an<br />

underscore (_). There is a great deal of speculation about these parameters. Since they are<br />

undocumented, some people believe they must be “magical,” <strong>and</strong> many people assume that<br />

they are well known <strong>and</strong> used by <strong>Oracle</strong> “insiders.” In fact, I find the opposite to be true.<br />

They are not well known <strong>and</strong> they are hardly ever used. Most of these undocumented parameters<br />

are rather boring, actually, as they represent deprecated functionality <strong>and</strong> backwardcompatibility<br />

flags. Others help in the recovery of data, not of the database itself; for example,<br />

some of them enable the database to start up in certain extreme circumstances, but only long<br />

enough to get data out. You have to rebuild after that.<br />

Unless you are so directed by <strong>Oracle</strong> Support, there is no reason to have an undocumented<br />

parameter in your configuration. Many have side effects that could be devastating.<br />

In my development database, I use only one undocumented setting, if any:<br />

_TRACE_FILES_PUBLIC = TRUE<br />

This parameter makes trace files readable by all, not just the DBA group. On my development<br />

database, I want my developers to use SQL_TRACE, TIMED_STATISTICS, <strong>and</strong> the TKPROF<br />

utility frequently (well, I dem<strong>and</strong> it actually); hence they need to be able to read the trace files.<br />

With the advent of external tables in <strong>Oracle</strong> 9.0.1 <strong>and</strong> above, we’ll see that we need not use<br />

even this parameter to permit access to trace files.<br />

In my production database, I don’t use any undocumented settings. In fact, the seemingly<br />

“safe” undocumented parameter just mentioned can have undesirable side effects in a live<br />

system. Think about the sensitive information that you might find in a trace file, such as SQL

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

Saved successfully!

Ooh no, something went wrong!