Page 99
As you can see, investing the extra time in implementing a naming convention for your database files results in names that have no guesswork involved. You can immediately determine their function by glancing at the name.
The OFA rule also dictates that database datafiles, redo log files, and control files should be stored in a dedicated directory off of the mount point. The following shows a directory structure that complies with this recommendation, containing data for four databases:
/u01 app oradata PROD [...] PPRD [...] DEVL [...] TEST [...]
All datafiles, log files, control files, and archived redo log files are stored in the directory under the oradata subdirectory. Each database has its own directory, and ONLY database files are stored in these directories.
A wise person once said that the great thing about standards is the variety from which to choose. This is especially apt when describing the OFA guidelines. There is no one perfect solution for creating an Oracle server environment because no two environments are the same.
The following are sample OFA implementations on both UNIX and Windows NT. These are meant to give you ideas and get you started. You may find specific points that, when reworked, serve your particular needs better than those presented. Explanations of each section are also given.
UNIX Implementation
/ Root Directory u01 u01 Mount Point app Application Directory oracle Oracle Application Directory admin Administrative Directory PROD PROD Database Directory pfile Initialization Parameter Files bdump Background Dump Files udump User Dump Files cdump Core Files create Database Creation Scripts sql SQL Scripts PPRD PPRD Database Directory [...] Same Directory Structure as PROD TEST TEST Database Directory [...] Same Directory Structure as PROD product Application Files
Directory
Page 100
7.1.3 Version 7.1.3 Files [...] ORACLE_HOME for version 7.1.3 8.0.3 Version 8.0.3 Files [...] ORACLE_HOME for version 8.0.3 qse QSE Application Directory admin Administrative Directory [...] Directories for QSE Administration product Application Files Directory [...] QSE Versions and Files oradata Oracle Database Files Directory PROD PROD Database Files PPRD PPRD Database Files TEST TEST Database Files u02 u02 Mount Point oradata Oracle Database Files Directory PROD PROD Database Files PPRD PPRD Database Files TEST TEST Database Files [...]
Windows NT Implementation
C: Drive Designator oracle Oracle Software Directory home Oracle Home Directory [...] ORACLE_HOME Contents oradata Oracle Database Files PROD PROD Database Files Directory [...] PROD Database Files PPRD PPRD Database Files Directory [...] PPRD Database Files admin Oracle Administrative Directories PROD PROD Administrative Directory [...] Same Structure as UNIX PPRD PPRD Administrative Directory [...] Same Structure as UNIX D: Drive Designator oracle Oracle Software Directory oradata Oracle Database Files PROD PROD Database Files Directory [...] PROD Database Files PPRD PPRD Database Files Directory [...] PPRD Database Files [...]
One of the crucial factors in making the OFA standards work is the separation of application and database files. The admin and oradata directories are created in order to keep all database- specific files separate from the Oracle software. This is necessary to fulfill one of the promises discussed earlier; the simple and transparent cutover to new software versions.
The final OFA rule from Mr. Millsap's paper we are going to discuss follows:
OFA Rule 6: Refer to explicit path names only in files designed specifically to store them, such as the UNIX /etc/passwd file and the Oracle oratab file; refer to group memberships only in /etc/group.
Page 101
If followed, this rule will help you avoid a common pitfall we all step into: creating an application "on the fly" that becomes a common tool used everyday, which breaks as soon as any system reconfiguration is performed. Avoid using hard-coded directory names in a shell script, batch file, or application program. When working with the Oracle tools, this is easier than it soundsany directory or value you might need to work with is probably already implemented as an environment variable or registry key.
The Oracle server is a complex set of interacting programs and processes. The software environment involved is likewise complicated and often difficult to understand. Various parameters exist to control the behavior of the Oracle programs, set the locations for configuration or shared files, define the language and character set to use, and a myriad other traits. On a UNIX machine, these parameters are stored as environment variables, which are usually loaded from the supplied coraenv or oraenv files called from the user's login script. On a 16-bit Windows computer, the parameters are stored in the oracle.ini file. On 32-bit Windows computers (Windows 95, Windows NT, and so on), these configuration parameters are stored in the Registry.
The environment variable files or Registry keys are created the first time an Oracle product is installed on a machine. Subsequent software installations add to and update these configurations. Systems programmers or DBAs also modify these configurations by hand to tune, troubleshoot, and customize the Oracle environment. A full description of the software configuration parameters can be found in your operating system-specific Oracle documentation. You should take a few minutes to familiarize yourself with the various parameters for your operating system many problems can be solved with careful tweaking of these parameters.
NOTE |
Don't confuse the Oracle configuration parameters with the initialization parameters of a database. The Oracle configuration parameters apply to the Oracle software installed on a computer, while the initialization parameters configure a single database. |
There are several environment variables with which you should be immediately familiar, as they play an important role in the operation of the Oracle server. ORACLE_HOME defines the base path for the Oracle software. It is explained in detail later in this chapter. ORACLE_SID is set to the default database SID (System Identifier) for your session. Many tools use the ORACLE_SID to determine what database to connect to. It is important you always know what values these variables are set tohaving wrong values for either of these can result in performing operations on the wrong database or using the wrong version of the Oracle tools.
When you install the Oracle software on a server or client computer, an Oracle directory structure is created to store the binary executables, shared libraries, configuration files, trace files, and so on used by the Oracle programs. This directory tree is semi-standard across different server platforms and versions of Oracle software. Both server and client software is stored in the same directory.