Saturday, August 3, 2013

Oracle Database Preinstallation – Part 11

Dear Readers,

My name is Franz Devantier, creator of this blog.  I am an Oracle Certified Professional (OCP DBA 11g) Security DBA.  I will be sharing with you the basic duties of an Oracle DBA, and also some of the undocumented, and not so well known tasks. 

I will make a deal with you:  If you refer me to a company that needs database support, from a few hours per week to full time, and I am able to sign a contract with them.
Then I will give you 10% of the monthly contract or deal price every month.  When the contract ends, and we re-sign the contract, I will again give you 10% of the monthly contract price.  This will go on until the company no longer employs or contracts me or my agents to look after their databases.
I can do this, because that 10% is my marketing budget.  When we re-sign the contract, in the future, it may depend on you giving the thumbs up again, and that is worth 10% of the monthly contract price, to be given to you as commission.

Oracle Database Preinstallation – Part 11
Identifying Required Software Directories
We must be able to identify or create the three required directory structures.  Oracle Base directory, Oracle Inventory Directory, and Oracle Home Directory.

It is important to make sure that the path for the Oracle Base and Oracle Home, use only ASCII characters.  This is because the installation owner names are used as part of some of the paths in these directory structures.  This ASCII character restriction applies to user names, file names, and directory names.  To comply with this requirement, you can use characters from the the following set only: "# % & ' () * + , - . / : ; < = > ? @ _ A-Z a-z 0-9
Remember that this restriction applies to Oracle 11.2
Further restrictions with regards to user and file naming rules from the Operating System, will also need to be adhered to.

Oracle Base Directory
The Oracle base directory is a top level directory, on which the Oracle installations are built.  The shorter this directory the better.  We also need to comply with Optimal Flexible Architecture (OFA), which recommends the following structure for the Oracle base directory:
/<mount point>/app/<software owner>
For example:
/u01/app/oracle
Or
/u02/app/grid

When you start a database instance using the server parameter file (spfile), with the ORACLE_BASE environment variable set, then the value of ORACLE_BASE is automatically stored in the spfile.  If you unset ORACLE_BASE, and restart the instance, then the database is able to use the value from the spfile, to find the oracle base directory.

If you have an existing ORACLE_BASE directory, then when you create a database using DBCA for example, it will be available to select during the database installation.  On the other hand if you don’t have an Oracle Base Directory, then you can create a new one in the list box, either by browsing for it, or typing it in.  By default the existing Oracle Base Directory will be stored in the list box.  Always best to define it before the time, and to make sure that it conforms to OFA standards.  Ie /u01/app/oracle

You can use the same Oracle Base Directory for multiple Oracle Installations.  You can also create separate Oracle Base Directories for different Oracle Software Installations.  If there are different Operating System users that are installing Oracle Software on the same system, then each of these Operating System users, must create a separate Oracle Base Directory.
For example:
/u01/app/oracle
/u01/app/orauser
/u01/app/grid

Oracle Inventory Directory
All the Oracle software installed on the system is reliant on the Oracle Inventory directory (oraInventory).  Once there is an Oracle Inventory path, the Oracle Universal Installer will continue to use that path or that Inventory.

When you install Oracle software on the system for the first time, then the path or location of Oracle Inventory is established from then onwards.  OUI tries to encourage you to use a OFA compliant path.  For example /u01/app would be the ideal path to give back to OUI.  Because then your oraInventory would be created as:
/u01/app/oraInventory
Which will go well with your Oracle base for example:
/u01/app/oracle
You see this is nicely laid out, easy to find, and does not get entangled in the ORACLE_BASE directory structure.

However if you have set the ORACLE_BASE during the OUI installation, then OUI will create the oracle inventory directory in the path ORACLE_BASE/oraInventory, which translates to /u01/app/oracle/oraInventory

If you have not created an OFA-compliant path, and you have not set ORACLE_BASE, then the Oracle Inventory directory is placed in the home directory of the user that is performing the oinstallation.
/home/oracle/oraInventory
OUI will create the directory, and set the correct owner, group, and permissions for it, you don’t need to create it.

Because all the Oracle software installations rely on the Oracle Inventory Directory, it is a point of failure, and so should be backed up regularly.  You should only delete this directory, once you have removed all Oracle products from the system.  The Oracle Inventory is not installed under the Oracle Base Directory, because there is only one Oracle inventory for all users.  Each user will have a separate Oracle Base directory.

Oracle Home Directory
This is where you install the Oracle software for a specific Oracle product.  You will need to install different Oracle products, as well as different releases of the same product, in different Home Directories.  When you run OUI, it will prompt you for the path to this directory, as well as a home name to identify it.

The directory that you specify, must be a subdirectory of the Oracle base directory.  For example:
ORACLE_BASE/product/11.1.0/dbhome_1
ORACLE_BASE/product/11.2.0/dbhome_1
ORACLE_BASE/product/11.2.0/grid

OUI will create the directory path that you specify, under the Oracle base directory.  OUI will also set the correct owner, group, and permissions to the directory structure.  So you don’t have to create this directory yourself.  You must not in fact specify an existing directory that has predefined permissions applied to it, as the Oracle Home Directory.  In a case like this you may experience installation failure due to file and group ownership permission errors.

Identifying or Creating an Oracle Base Directory
You must identify or create an Oracle Base Directory, before starting the installation.  You can create an Oracle Base Directory, even if other base directories already exist on the system.

Identifying an Existing Oracle Base Directory
You may find that the existing Oracle Base Directories, do not comply with the Optimal Flexible architecture (OFA).  Even so, if you can identify existing home directories, or Oracle Inventory directories, then you can usually identify the Oracle Base Directories.  It is not good practice to put the oraInventory directory under the Oracle Base directory for a new installation.

How to look for existing Oracle Home directories:
$ more /etc/oratab
If the oratab file exists, then it should contain code that looks something like:
*:/u01/app/oracle/product/11.2.0dbhome_1:N

These entries in the oratab file identify Oracle home directories.  The base directories usually end with the oracle username, so from the above example the base directory would probably be:
/u01/app/oracle

To install Oracle software, try to choose one of the directory paths that complies the most with the OFA.  You may find the Oracle inventory directory as well.
$ cat /u01/app/oraInventory/ContentsXML/inventory.xml

Before you use the newly found Oracle base directory, make sure that it is not on the same file system as the operating system, and that there is sufficient free disk space available.
If the Oracle base directory is to contain only the software files, then up to 4GB of free disk space is required.  If the Oracle base directory is to contain both software and database files (which would not do for a production system), then you would need up to 6GB of free space.

You will need to determine how much free space is available on the Oracle base directory.
$ df –h ORACLE_BASE_PATH
When you configure the Oracle users environment, then you will set the ORACLE_BASE environment variable with the oracle base directory that you have chosen.  If you were not able to find a suitable Oracle base directory, then you may need to create a new base directory.

Creating an Oracle Base Directory
Your first step is to identify a suitable file system with sufficient disk space on it.
Check all the mounted file systems, to see how much space is available:
$ df –h
You will examine the output to find a filesystem with sufficient space on it.  You can choose a local file system, a cluster file system, or a NFS file system on a certified NAS device.

Now you can make a note of the mount point name, for the file system that you identified.  You will now be able to create the Oracle base directory, and secify the owner, group and permissions on them.
$ mkdir –p /<mount_point>/app/<oracle_software_owner>
$ chown –R oracle:oinstall  /<mount_point>/app/<oracle_software_owner>
$ chmod –R 755 /<mount_point>/app/<oracle_software_owner>

Now you can set the ORACLE_BASE environment variable to point to the Oracle base directory that you have just created.

Franz Devantier,
Need a database health check?
devantierf@gmail.com

Classifieds

No comments:

Post a Comment