How to Install and Configure Oracle on Linux
Oracle RDBMS is a full-featured relational database management system from Oracle Corporation. It includes a set of administration tools, and precompilers for most programming languages. This article will cover how to install and configure an Oracle database on Linux.
The installation file for Oracle 8.0.5 Enterprise Edition is named Oracle8051EE_Intel.tgz. It can be downloaded from ftp://technet.oracle.com/. If needed, the glibc patch file glibcpatch.tgz can be downloaded from ftp://ftp.oracle.com/pub/www/otn/linux/.
Oracle currently uses glibc 2.0 rather than glibc 2.1. Oracle has supplied a patch which, when combined with compatibility RPM packages, allows it to run on Red Hat 6.0. I chose to use the Linux-Mandrake 6.0 distribution for this installation. If you are not using 6.0, you can skip the steps for installing the compatibility RPMs and the glibc patch. It is possible to install Oracle on other distributions, but since Oracle uses Red Hat for its development, Red Hat (or some variation of Red Hat) is preferred.
The C Development package must be installed when you install Linux. If you want to install Oracle's Intelligent agent, you must have tcl-8.0.3-20.i386.rpm installed. To install the JDBC drivers, you must define a path to your classesxxx.zip file.
I recommend creating a minimum of three partitions for Oracle. This allows you to use Oracle's Optimum Flexible Architecture (OFA) standard. Using OFA gives you the capability to segregate data from indexes and have multiple control files. The partitions should be named u01, u02 and u03. You can create more partitions if you have the disks to support them. I have two disks on my machine, so I created a partition of 1GB for /u01 and 150MB for /u02. I then created a directory called /u03 to give me the equivalent of another mount point. The first partition (/u01) is where the Oracle executables and all associated files will be placed during the installation process. The remaining mount points will be used for data files, indexes and control files.
A multitude of directories are created during the installation process. Some of the more important ones are:
$ORACLE_HOME/bin contains the executables for the database and administrative software.
$ORACLE_HOME/rdbms/admin contains the SQL scripts used to create the catalog, and other useful scripts too numerous to cover here. Refer to the Oracle Database Administration Manual for an explanation of the scripts contained in this directory.
$ORACLE_BASE/admin/SID/bdump contains the alert log for the instance. The name of the alert log is alert_SID.log, where SID is the system identifier for the instance (i.e., alert_greg.log for this installation). This file is extremely important in determining where problems lie. Any time you have an error or database crash, this is the first place to look for information on what might have happened to cause the problem.
$ORACLE_HOME/network/admin contains the tnsnames.ora and listener.ora files. Both of these files are described in the section on modifying configuration files.
$ORACLE_HOME/precomp/demo/proc contains several Pro*C example programs.
The data files, indexes and control files will be placed in /oradata/SID, where SID is the system identifier for the instance (i.e., /u01/oradata/greg, /u02/oradata/greg and /u03/oradata/greg for this installation).
The installation is broken down into 8 steps:
Pre-installation sets up the groups and users, and performs all the tasks prior to actually installing the software.
Software installation is the process of installing the software.
Documentation installation is the process of installing the on-line documentation for Oracle. This must be done in a separate step due to a bug in the installation process.
Binary patching is the process of applying the glibc patch supplied by Oracle.
Database creation creates the initial database.
Post-installation is the process of running a post-install script as root.
Configuration file modification is the process of identifying and modifying the configuration files used by the database and Net8.
Testing and automation is the final process of determining that the database is installed and configured properly, and setting the instance up to start automatically when the machine is rebooted.
Download the compatibility RPMs from Red Hat. The necessary RPMs are compat-binutils-5_2-2_9_1_0_23_1_i386.rpm, compat-glibc-5_2-2_0_7_1_i386.rpm, compat-egcs-5_2-1_0_3a_1_i386.rpm, compat-egcs-c++-5_2-1_0_3a_1_i386.rpm and compat-libs-5_2-1_i386.rpm. Issue the following commands to install the RPMs:
rpm -ivh compat-binutils-5_2-2_9_1_0_23_1_i386.rpm rpm -ivh compat-glibc-5_2-2_0_7_1_i386.rpm rpm -ivh compat-egcs-5_2-1_0_3a_1_i386.rpm rpm -ivh compat-egcs-c++-5_2-1_0_3a_1_i386.rpm rpm -ivh compat-libs-5_2-1_i386.rpm
Edit /etc/passwd for root and change the shell from /bin/bash to /bin/sh. This will make the installation scripts supplied by Oracle run without errors.
Create the groups and users used by Oracle. At a minimum, you will need a group called dba for the oracle user. You may also want to create a group called oper for the operation of the database. Refer to the Database Administrator's Guide for Oracle to determine whether you want to create this group. In the following example, I used only the dba group, with a group ID of 601. You may need to use a different group ID if 601 is already in use on your system. Be sure to change the password for the oracle user.
groupadd -g 601 dba useradd oracle -g 601 passwd oracle
Edit /etc/passwd as root to change the default shell.
Create the directories for your mount points if you didn't create them as partitions. Repeat the commands for all three mount points if necessary.
mkdir /u01 chown -R oracle.dba /u01
Change to the directory where you have unpacked the Oracle8051EE_Intel.tgz file (this is your staging directory for the installation process), and run the script to create the /etc/oratab file. This file is used by Oracle's startup script to determine which instances are running on the machine, and whether they should autostart when the machine is rebooted. More on this file later.
cd /home/oracle/orainst/orainst ORACLE_OWNER=oracle; export ORACLE_OWNER sh oratab.shSee Figure 1 for prompts and their replies.
Log out as root and log in as oracle. Make sure umask is set to 022 by typing umask. If it is not set to 022, you will need to add a line to your .profile file. Set the following environment variables in oracle's .profile:
ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/8.0.5 ORACLE_SID=greg #(replace with your system #identifier) ORACLE_TERM=386 PATH=$PATH:/u01/app/oracle/product/8.0.5/bin TMPDIR=/var/tmp export ORACLE_BASE ORACLE_HOME ORACLE_SID\ ORACLE_TERM export PATH TMPDIR umask 022 #(only if the umask is not already #set to 022)
Log out, then log back in as oracle. Make sure the environment variables are set by using the env command, and that /bin:/usr/bin:/usr/local/bin is in your path.
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal
- New Products
- Users, Permissions and Multitenant Sites
- Flexible Access Control with Squid Proxy
- Security in Three Ds: Detect, Decide and Deny
- High-Availability Storage with HA-LVM
- Tighten Up SSH
- DevOps: Everything You Need to Know
- Solving ODEs on Linux
- Non-Linux FOSS: MenuMeters
- diff -u: What's New in Kernel Development