You need to quickly install and configure a new Oracle database server. For many of you, this will be a straightforward process, for others maybe not so easy. Where to start? What to do first?
Today I decided to write this post about some of the basic steps and considerations you should keep in mind when installing an Oracle Database environment. The reason for this is that over the last few years I have seen more and more really bad installations. Some that were actually horrible… And one thing that I can guarantee is that maintaining a badly installed and configured Oracle environment is not easy – especially if there is limited (or none!) documentation on the site’s installation. I have seen too many large sites where most of the complexity was around the environment setup and configuration. You may find it surprising, (or you may have been there), but I have seen DBA’s even afraid to work on these environments.
It does not have to be this way. With just a few basic steps you can install and configure your Oracle environment in a way that will make it easy for others to understand and support.
So lets start at the beginning. You need to install Oracle on a server. What Operating System (OS) to use? I find that this differs from company to company. Are you standardized in using Windows or Linux or Solaris or AIX or HP-UX, or are you in a position to decide on the OS? Now I am not going to get into a war on which OS to use, however, I have used all of these and found that my favorites are still Linux (Oracle Linux or Redhat) and Solaris. I found Linux and Solaris to be reliable and have seen them perform in highly loaded environments, and when High Availability is a requirement these would be my first choice.
I will not go into the OS installation in this post, as I am sure most of you have done many installations. But if you have never done so, a nice and easy way to learn how-to install Linux is to download the ISO images and use one of the many desktop Virtualization software packages out there, such as VirtualBox; create a new Virtual Machine and install the OS. Review all the options, and repeat. Before you know it you will be familiar with the installation process.
A quick few tips at this stage:
- If you are using Oracle Linux, I do recommend you use the latest version available. For example, if you are looking at using Oracle Linux 5, use the latest update, which at the time of writing this post is update 8. So you will see Oracle Linux 5.8 being referenced in many places. This just means it is release 5 update 8. For release 6 it is update 3. As always, please review the licensing and support options to make sure you are correctly licensed and have support, as this will entitle you to the latest software updates and patches.
- When installing the OS, ensure you select the “oracle-validated” package; it will save you a lot of time and headaches.
- Consider adding the Oracle public Yum repository after the installation is complete. This will make installing individual packages quick and easy. For more details see: http://public-yum.oracle.com
- If you are looking at Oracle Linux 6.3, after setting up the public yum repository, you can run this command to install pre-requisite software packages. “yum install oracle-rdbms-server-11gR2-preinstall”
- If your hardware allows it install 64bit software versions. I cannot remember when I last installed a 32bit version. 64bit should be the default recommended choice nowadays.
At this stage I will assume that you have the OS installed. The next step is to confirm the Oracle Database software version you need to install. Confirm with the application vendor what the latest supported version is. Always attempt to use the latest possible version available. For example, at the moment Oracle 11g release 2 – 126.96.36.199 is the latest version available (Support contract is required to download this version). In addition, no matter which release you are using, always aim to install the latest patches. This is recommended to ensure you end up with the most up to date stable installation. Another important note is make sure you only install the software edition that you are licensed for. If you are only licensed for Standard Edition, do not tempt yourself and install Enterprise Edition. Install the correct edition from the beginning and make sure you are 100% aligned with your licensing.
One of the best places to start when installing Oracle Software is the online documentation. Yes, I know reading documents is not always that much fun, and it is easier to just jump into it and start. If you have done many installations before, then that is fine, but if this is one of your first installations, please follow the Installation Guide. There are a few basic things I want to highlight when installing Oracle.
Note: As most will probably be installing Oracle 11g Release 2, this is what I will be focusing on.
Ensure your user accounts are created with passwords assigned, and create all the required operating system groups. If you are looking at using ASM you will need to install “Grid Infrastructure” as well as the “Database Software”. In this scenario I tend to use two user accounts. The “grid” user account for the “Grid Infrastructure” software and the “oracle” user for the “Database Software”. The documentation explains these in detail., but make sure you have all the groups and users accounts ready before you start the installation.
Groups: oinstall, dba, oper, asmadmin, asmdba, asmoper Users: oracle, grid Group Assignment: oracle: default group oinstall, other groups include: dba, oper, asmdba grid: default group oinstall, other groups include: asmadmin, asmdba, dba
Oracle base software directory
When installing oracle on Unix, I always make sure that I have a file system with sufficient disk space for the Oracle software. I prefer not to keep this directory inside the “root (/)“ file system. I tend to create a separate LUN or partition for a mount point named “/u01”. I also tend to make sure I have sufficient space in this file system for upgrades or patches. For example, database software takes approx. 4G to 5G of disk space, so I would tend to assign at least 20G to /u01 to start off with. That way I know I should have some space for patches or upgrades going forward. If ASM were used then I would increase the space to include the Grid Infrastructure home. I found that a good starting point of 30-40GB is sufficient for most systems, even RAC. Disk space is not that expensive nowadays, and I would rather have a little bit more disk space to work with when doing upgrades at a later stage than struggling with not having sufficient space.
I assume with the above storage allocations that you will be creating a separate file system for the database files, or you might use ASM. But if you do want to put your database under the /u01 file system I suggest you make sure you have sufficient disk space from the beginning.
One thing that I have seen a few times recently was Oracle software installed into the user home directory, which would be something like /home/oracle. You then end up with “/home/oracle/app/product/11.2.0/dbhome_1” as the software location. To be honest, this is just WRONG. Never ever install oracle under “/home/oracle”. This is not the correct place for it, and I just had to mention this in case someone is tempted to do so.
But what is the correct location to install the software into? Before I get to that, first there is a location you need to know about; the Oracle Base Directory, also known as ORACLE_BASE. This is the top-level directory for Oracle software. At this stage I would like to mention the Optimal Flexible Architecture (OFA), which is a standard that helps you manage directory structures in an optimal way especially when using different software versions on the same system. For more details please see here.
In summary the ORACLE_BASE location is defined as /mount_point/app/software_owner – so in my example the ORACLE_BASE would be set to /u01/app/oracle.
This does not seem that important, but having this basic directory structure in place makes the rest so much easier. Once this is done I always update my software owner’s environment to include this environment variable. In this case I would update the oracle .bash_profile and add the two lines:
ORACLE_BASE=/u01/app/oracle export ORACLE_BASE
The Oracle Home folder
The Oracle Home folder, also known as ORACLE_HOME is the location where the Oracle Database software will be installed. This is not the location of the database files, but what most would refer to as the database “executables” installation path.
If you have done the previous step where you created the ORACLE_BASE this step is easy. During the software installation the installer will provide you with a default path, based on your ORACLE_BASE environment, which will look something, like this:
Now when I look at a new system and I see the path above I would have a pretty good idea where everything is. So let’s say you are installing a second Oracle software set; you have 188.8.131.52 installed in /u01/app/oracle/product/11.2.0/dbhome_1 and now want to install the latest 184.108.40.206 software set (patched). You can then just install the software into /u01/app/oracle/product/11.2.0/dbhome_2. As you can see only the last directory changed from dbhome_1 to dbhome_2. You will now have version 220.127.116.11 installed in the dbhome_1 directory and 18.104.22.168 into the dbhome_2 directory. The Oracle Base directory for both Oracle Homes above will be the same.
If this is the first time you see this directory structure it might seem a bit strange, but you will quickly get used to it. Something I like to do is to just shorten the directory “dbhome_1” to “db_1”.
So where are my log files?
The next directory I would like to mention is the Diagnostic Destination, also known as Automatic Diagnostic Repository. Following the Oracle software installation, this is where you will find diagnostic data such as trace files and the database alert log, to name just a few. I am not going to discuss this in detail, as I would like to leave that for a separate post. What I do want to highlight is that this directory is created by default in the ORACLE_BASE directory and is called “diag”. So if you have Oracle 11g installed and the ORACLE_BASE environment variable is set you will find the “diag” directory inside the ORACLE_BASE location. For example, in my case the diagnostic destination directory is located in /u01/app/oracle/diag. This repository has the following directory structure:
As an example, I have a database called “testdb”, and the following directory structure will exist:
The above directory is known as the ADR Home directory for the “testdb” database. Now this directory has a few sub directories of which I would like to highlight 2 for now. One, which is called “alert”, and a second which is called “trace”. The “alert” directory contains an XML formatted database alert log, where the “trace” directory contains a plain text formatted alert log as well as all the other background and server process trace files. So if you are quickly looking for a trace file or the alert log, you will find it in this trace directory, which in my environment is:
What is the /etc/oratab file?
I am now getting to one of the things I love about using Oracle on Unix. Managing multiple versions of Oracle Database software on one server is easy. For example, if you have 3 Oracle software installations on your server, let’s assume you have 10.2.0.5, 22.214.171.124 and 126.96.36.199 installed, the directory structure will look something like the following:
Oracle Base: /u01/app/oracle 10.2.0.5 Oracle Home: /u01/app/oracle/product/10.2.0/db_1 188.8.131.52 Oracle Home: /u01/app/oracle/product/11.2.0/db_1 184.108.40.206 Oracle Home: /u01/app/oracle/product/11.2.0/db_2
You have 3 databases, one per home. Example: 10.2.0.5 database is called CRM, the 220.127.116.11 database is called HRM and the 18.104.22.168 database is called FMS.
Now if I am on the command line and I want to quickly set my environment to make sure I am using the 22.214.171.124 software I just run the “oraenv” program and when asked specify the database I want to set the environment for. An example to set the environment to the FMS database is seen below:
oracle@dbvlin101[/home/oracle]: . oraenv ORACLE_SID = [oracle] ? FMS The Oracle base remains unchanged with value /u01/app/oracle oracle@dbvlin101[/home/oracle]: env|grep ORACLE_HOME ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_2
Now that my environment is set I can connect to the FMS database using the correct “executables” (software).
oracle@dbvlin101[/home/oracle]: sqlplus /nolog SQL*Plus: Release 126.96.36.199.0 Production on Wed Nov 21 14:11:51 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. 14:11:51 SQL> connect / as sysdba Connected.
If I was on Windows with multiple Oracle software installations, you have to manually update the environment, which can be a pain when you want to quickly do some urgent work.
So what does /etc/oratab file have to do with this. Well, this is the file that is used when you run the “. oraenv” command. It is used to look-up and find the ORACLE_HOME for the database that you specify. If we look at the /etc/oratab file you will see the following entries in it:
CRM:/u01/app/oracle/product/10.2.0/db_1:N HRM:/u01/app/oracle/product/11.2.0/db_1:N FMS:/u01/app/oracle/product/11.2.0/db_2:N
Now the format of the file can be summarized as:
Remember, Unix is case sensitive so make sure you use the correct case. The <Y|N> value can be used to specify if the database should be auto started at server startup. So just specify N for now and once you start working on the auto starting of the databases you can review this option.
It is good practice to make sure that after you have created a database you ensure it is specified in the /etc/oratab file. Trust me, it will make life a lot easier.
I still have a few other options I would like to mention, but I think I will leave that for another day. However, remember when installing and configuring Oracle, keep it simple and get the basics right. You will make it so much easier for ongoing support and fellow DBA’s will find it easy to support environments you installed. And the most important bit is documentation! Document your installations and configuration changes. I know it is the bit everyone hates, but it is important for ongoing support and maintenance to have a well-documented database environment.