Linux DevCenter    
 Published on Linux DevCenter (
 See this if you're having trouble printing code examples

Installing Oracle 9iR2 on Red Hat 9

by Roko Roic

There are an ever-growing number of reasons to run the Oracle database server on a Linux-based OS. The price factor is obvious, as OS licenses can really boost the total price of your multiple workstation or clustered (RAC) server installation. Then there's the stability factor, the possibility of total remote administration, the availability of platform source code, speed, flexible filesystem, the strong Unix legacy .... Heck, even Oracle itself runs its business on what they like to call Unbreakable Linux.

Red Hat's latest and greatest Linux distribution release comes with quite a few improvements, many of which are targeted at the needs of the workstation user. As new hardware owners become early adopters, this OS will surely dominate Linux developers' workstations in the months to come. Support for cutting-edge hardware and software technologies, easier maintenance via graphical configuration tools, polished office and productivity applications, a unified interface, development tools, and, of course, Red Hat's reputation will also make it the OS of choice for many Oracle developers. Unfortunately, unless the current version was certified, Oracle installation hardly ever ran smoothly on Red Hat Linux. Still, where there's a will, there's always a way. With a little help from this article, you will have your Oracle 9iR2 server running in no time on your new Red Hat 9 box. Let us begin.

Adding Users and Groups

First, you will need to create the Oracle installation and users and groups. Oracle installation needs two Unix user groups and one runtime Oracle user.

Log in as root and issue the following commands in a terminal:

[root@miniroko]# groupadd dba
[root@miniroko]# groupadd oinstall
[root@miniroko]# useradd -g oinstall -G dba oracle
[root@miniroko]# passwd oracle

The last command will prompt you to enter the password for your oracle user. Make sure you remember it, because you will probably need it as we go along.

Creating Directories

Oracle recommends OFA, the Optimal Flexible Architecture directory structure for a deployment server, but on a development machine and for the sake of simplicity, we will install everything under /opt/ora9.

Just make sure you have at least 3.5GB available for a full installation including one database, and issue the following commands as root:

[root@miniroko]# mkdir -p /opt/ora9/product/9.2
[root@miniroko]# mkdir /var/opt/oracle
[root@miniroko]# chown oracle.dba /var/opt/oracle
[root@miniroko]# chown -R oracle.dba /opt/ora9
[root@miniroko]# chmod 755 /var/opt/oracle

You have now created Oracle runtime directories and granted write privileges to user oracle and execute privileges to group dba.

Installing Required Tools and Libraries

You will need to install the following Red Hat backward-compatibility and software-development packages before we get further underway. All of these packages can be found on Red Hat installation CDs 1-3.


You can install these packages using Redhat's graphical package manager available in Start menu->System Settings->Add/Remove Applications, or from the command line, using:

rpm -Uvh <package_name>

Replace package_name with each RPM listed above.

Important notice: A shrink-wrapped Red Hat 9 and the freely downloadable version do not contain the same glibc package. The purchased version contains some patches needed for Oracle Intelligent Agent to run correctly, while the downloaded version does not contain these patches. If you are unsure which version of Red Hat you have installed, you will be on the safe side if you replace your glibc packages with prepatched glibc packages prepared by Jason McIntosh. His RPMs were built from the same source (*.rpms) files as the original ones, but with the required patches applied.

If your system contains a non-empty /lib/i686 directory, fetch the i686 packages. Otherwise, you may run into trouble with misplaced libraries. Where an i686 version of the package is not available, just use whatever is.

Once you have downloaded all of the packages, use the command line rpm tool to upgrade:

% rpm -UVh package_name

Setting Kernel Parameters

Red Hat religiously sets some kernel parameters too conservatively. Check your hardware configuration and assign enough shared memory, open files, and ports, or you may run into trouble installing and running Oracle. Append these lines to /etc/sysctl.conf to set kernel parameters:

kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem    = 250 32000 100 128
fs.file-max   = 65536

net.ipv4.ip_local_port_range = 1024 65000

Append these lines to /etc/security/limits.conf to modify your resource limits:

oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384

Reboot the system so the kernel changes can take effect. If rebooting is not an option, you can change the kernel params at runtime by issuing:

[root@miniroko]# echo 250 32000 100 128 > /proc/sys/kernel/sem
[root@miniroko]# echo 536870912 > /proc/sys/kernel/shmmax
[root@miniroko]# echo 4096 > /proc/sys/kernel/shmmni
[root@miniroko]# echo 2097152 > /proc/sys/kernel/shmall
[root@miniroko]# echo 65536 > /proc/sys/fs/file-max
[root@miniroko]# echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range

For a full explanation of the /proc filesystem and available parameters, you might want to read Red Hat's Online Linux Manual.

Oracle Regular Expressions Pocket Reference

Related Reading

Oracle Regular Expressions Pocket Reference
By Jonathan Gennick, Peter Linsley

Setting up the oracle User Environment

Log in as the oracle user:

% su - oracle

I will assume that you are using the default bash shell for this user. Setting environment variables in other shells may differ from this example, so check your shell's manual page or set bash as the oracle user's shell. We will set up Oracle basic environment (users, paths, locale) and some extra values needed for Oracle to run correctly on Red Hat 9. Put the following lines at the end of ~/.bashrc:

# oracle 9i
export ORACLE_BASE=/opt/ora9
export ORACLE_HOME=/opt/ora9/product/9.2
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export ORACLE_OWNER=oracle
export ORACLE_SID=ora9i
export ORACLE_TERM=xterm

# Use old Linuxthreads with floating stacks instead of
# the new Native POSIX Thread Library (NPTL)
export LD_ASSUME_KERNEL=2.4.1
export THREADS_FLAG=native

# Edit paths
export LD_LIBRARY_PATH=/opt/ora9/product/9.2/lib:$LD_LIBRARY_PATH
export PATH=/opt/ora9/product/9.2/bin:$PATH

# change this NLS settings to suit your country:
# example:
# german_germany.we8iso8859p15, american_america.we8iso8859p2 etc.
export NLS_LANG='croatian_croatia.ee8iso8859p2'

If you are using other national settings for Oracle (these are Croatian), consult the supported settings and change the NLS_LANG variable accordingly.

The Red Hat 9 Linux kernel comes with the new Native POSIX Thread Library, which causes Oracle installation to hang. By setting the LD_ASSUME_KERNEL variable to an older kernel version, we are making Linux use the old Linuxthreads library. For more information about the difference between these threading methods, please consult the Red Hat 9 Release notes.

Running the Installer

To install 9iR2 on Linux, Oracle recommends at least 512MB of RAM and at least 400MB of swap space. If you have less then 512MB of RAM and upgrading is not an option, you can resize your swap partition or create temporary swapping space. The later is a much more convenient option, as you will be needing this space only during the installation.

To set up a temporary Linux swap area, execute these lines as root:

% dd if=/dev/zero of=tmp_swap bs=1k count=900000
% chmod 600 tmp_swap
% mkswap tmp_swap
% swapon tmp_swap

After you finish installing, you can free this space:

% swapoff tmp_swap
% rm tmp_swap

Now that you have all the major obstacles out of the way, you can run the installer. Please remember that the Oracle installer must be run from X. You will need to allow the local oracle user to write to your X display:

$ xhost +

Do not change to your CD-ROM mount directory (e.g., /mnt/cdrom), because you will not be able to unmount the first CD to insert others when asked. Start the installer from your home directory using:

$ su - oracle
$ /mnt/cdrom/install/linux/runInstaller


We will not describe the installation process in detail, as Oracle provides extensive documentation on that subject and it is way beyond the scope of this article. It is pretty much self-explanatory, but if you run into trouble, there's always a help button to assist you. If you need more help, check the docs directory on the Oracle CDs, the online Oracle Documentation, or Oracle Linux Center. During the installation, Oracle will ask you to insert other disks. When asked, open up a new console, unmount the current disk with umount /dev/cdrom (as root) and replace the disk. If Red Hat 9 does not mount it automagically, mount it yourself with mount /dev/cdrom and choose to continue with the installation wizard.

As you go along, your installation may produce three different errors:

Do not create a database at the end of the installation. Not all things are operational at this point, and we still need to perform some minor fixes. Click on Software only and continue. Don't worry, you will be able to create your database later using dbca, the Oracle database configuration assistant.

Database Create Screenshot
Figure 4. Do not create a database


Let's fix the issues Oracle had with and starting the agent. Open a new terminal and log in as the oracle user. Execute these lines:

[oracle@miniroko oracle]$ cd $ORACLE_HOME/network/lib
[oracle@miniroko lib]$ make -f install

Now edit the $ORACLE_HOME/ctx/lib/ file. Change lines 13-14 from:

ctxhx: $(CTXHXOBJ)


ctxhx: $(CTXHXOBJ)

You are now ready to retry making:

[oracle@miniroko lib]$ make -f $ORACLE_HOME/ctx/lib/ install

Voila, you now have a fully working installation of Oracle 9iR2 database server. If you wish, you can now create your Oracle database using dbca.

Starting and Stopping the Database

svrmgrl is no longer supported by Oracle, so use sqlplus for startup and shutdown operations. To start the server:

[root@miniroko]# su - oracle
[oracle@miniroko oracle]$ lsnrctl start
[oracle@miniroko oracle]$ sqlplus /nolog
SQL*Plus: Release - Production on ?et Svi 29 13:52:34 2003
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area   93393176 bytes
Fixed Size                   450840 bytes
Variable Size              75497472 bytes
Database Buffers           16777216 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release - Production

To shut down the server:

[root@miniroko]# su - oracle
[oracle@miniroko oracle]$ lsnrctl stop
[oracle@miniroko oracle]$ sqlplus /nolog
SQL*Plus: Release - Production on ?et Svi 29 13:55:32 2003
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
SQL> connect / as sysdba
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release - Production

To integrate Oracle with Red Hat's SysV init process and make startup and shutdown automatic, you can use Gurulab's Oracle9i RHL Run Package. I do not recommend Oracle's native scripts $ORACLE_HOME/bin/dbstart and $ORACLE_HOME/bin/dbshut, as they do not always work as advertised and require some changes.


You now have a fully featured Oracle installation on your computer. Please remember that Oracle 9.2 is not certified for Red Hat 9, and that this combination is not endorsed in production and deployment environments. As a workstation, however, it is perfectly stable and usable.

Roko Roic currently works at Tis.kis, developing core and user-level GSM related systems.

Return to the Linux DevCenter.

Copyright © 2009 O'Reilly Media, Inc.