Site Navigation
Harry's Place Business Site Tools Articles Change Colour
Almost a blog
Other Sites
The Banana Tree

Oracle on Linux

Purpose of this tutorial.

The purpose of this turtorial is to get you running Oracle in as little time and as stress free as possible. It should also leave you in a position where you can take your investigations of Oracle further. If you have any questions please feel free to Contact Me.

What this tutorial is not.

This guide will NOT leave you with a fully tuned unbreakable database or even a database that will perform well but it will leave you in a position where you can start looking at the various features supported by Oracle. I would not recommend using this tutorial to base a production install on.

Is it hard to Install.

This is a very subjective question and depends very much on who you ask. If you ask a DBA who has been using Oracle for years then you will probably be told that it depends what you want to use it for.

If you want to have a simple database to learn PL/SQL, run a test website against or try and port an application to then the database should be relatively easy to install and get running, at least no harder than Postgres or MySQL. The Oracle Universal Installer will be more than sufficient to get you up and running in no time at all, when it works, but thats another story.

On the other hand if we look at the typical scenario where a companies data has become its most critical asset then the expectations and requirements from your choosen O/RDBMS become that much greater. Imagine trying to setup a cluster with a standby or a distributed database replicated all over the world. Oracle is one of the few products today that support these types of features but it is not an easy task setting them up and even harder to manage them properly when they are running.

Some preliminaries

This tutorial will teach you how to install Oracle on Redhat Advanced Server 2.1 (RHAS). For people wanting to install Oracle onto different platforms please check out which platforms are supported RHAS 2.1 is not mentioned as a supporterd platform in the install guide but I assure you that it is. Oracle can also be installed onto other flavours of Linux if you have a big enough stick to beat it with but for a first timer I recommend running with a supported platform. All of the required documentation that you will ever need can be found here

Oracle has been installed on various flavours of Linux including Debian. I cannot tell how much success you will have by using this turtorial and a version of Linux other that RHAS 2.1 but the install procedure will be pretty similar on any Linux platform you choose.

Getting Started

I have taken some ot the following requirements from the Oracle documentation and some from my system.

Hardware requirements

You will need a minimum of 512Mb of RAM, I am not sayingmaking this up I have tried it with less and it is an absolute bugger to install. Oracle is a memory intensive beast and the more RAM you can afford the better. Swap space should be at least the same size as you RAM. You will also need about 5/6Gb of free space on a single hard drive.

Software Requirements

            RHAS 2.1 Developers Edition. 
            Kernel 2.4.7
            Glibc 2.2.2
            X Windows
            My Platform Setup
            1 20Gb Fujitsu 10000rpm SCSI
            3 20Gb IDE
            512Mb RAM
            AMD XP1700
            Kernel Version 2.4.9e.5

Checking Software Requirements

To check that you have the correct kernel and software versions you can use the following commands.

                cat /proc/sys/kernel/osrelease
            	rpm -q gcc cpp compat-libstdc++ glibc-devel kernel-headers binutils


The first thing to do is to acquire the software. Oracle is freely available for development purposes and can be downloaded from their website. I did contact Oracle about doing a demo website running on Oracle for my CV but the where going to charge me several thousand pounds for the priviledge so I decided to use Postgres instead. Be aware that the software is over 1.5Gb and comes on three CD,s To download Oracle follow this link You may need to become a member of the Oracle Technical Network to get the software. I can recommend becoming a member and subscribing the the Bi Monthly Oracle Magazine which is free. It has some great articles on Linux and some of the uses people are putting it to.

Under version Choose. (Do not choose

Oracle9i Database Release 2 Enterprise/Standard Edition for Linux

There is a lot of data to be downloaded so either ask someone with a very fast connection to download them for you or go to an internet cafe where they can do this for you. Follow the process until you get to the software donwload page and download the three disks.

Burn the disks to CD's for future use if required.

Kernel Configuration

Before starting the install there are a few things that we need do to the kernel first. You will need to be logged in as root to perform these tasks. Everyone knows the dangers of logging in as root but it never hurts to be told. Be careful.

There are a few kernel parameters that we need to check to ensure that they are correct for Oracle. The following settings are what I am using on my system. I have not deliberately selected the best settings for Oracle or tried to tune them in any way other than increasing shmmax above half my RAM. If you want to tune Oracle on Linux the following parameters are one of many areas you will need to investigate further.

                First we need to check the semaphore settings for shared memory 
		        cat  /proc/sys/kernel/sem
             	        250	32000	100	128
		To change these parameters to the settings above:
		     echo 250 32000 100 128 > /proc/sys/kernel/sem
                To check shared memory. Oracle recommends half your RAM but I choose 320Mb 
                 	cat /proc/sys/kernel/shmmax 
                 	cat /proc/sys/kernel/shmmni
                 	cat /proc/sys/kernel/shmall
                To change your settings to the above:
                 	echo 235544320 > /proc/sys/kernel/shmmax
                 	echo 4096 > /proc/sys/kernel/shmmni
                 	echo 2097152 >  /proc/sys/kernel/shmmni
                Now we edit the maximum number of open files descriptors and process limit using "ulimit"

                        ulimit -n
                 	ulimit -u
                To set these use 
			ulimit -n 65536
                 	ulimit -u 16384
                Now we set the local port range
			cat /proc/sys/net/ipv4/ip_local_port_range
                 	1024 61000
                To set this use 
			echo 1024 61000 > /proc/sys/net/ipv4/ip_local_port_range

This should be all the kernel configuration required. I recommend using /etc/sysctl.conf file to set the kernel parameters permanently.

Setting up groups and the Oracle User

We will need to be logged in as root for this. The first thing we need to do is set up a database administrator group and another group that will own and administer the installation of the Oracle software including patches etc. This can be done using the addgroup command as follows.

	        groupadd dba
            	groupadd oinstall

We will also require a user to administer the system. This user will needs to be a member of both the "dba" and the "oinstall" groups becasue it is as this user we are going to install and configure the database.

            	adduser oracle -g oinstall -G dba

Its as simple as that. Remember that any memeber of the dba group will have complete control over the Oracle database because they are granted SYSDBA priviledges. Now that we have the user set up we need to edit some environement variables for the oracle user. Using you favourite text editor and add the following text to /home/oracle/.bash_profile

            	export ORACLE_BASE=/opt/oracle
            	export ORACLE_HOME=/opt/oracle/product/
            	export ORACLE_SID=mynewdb
            	export ORACLE_TERM=xterm
            	export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
            	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
            	export EDITOR=/usr/bin/vim
            	export PATH=$PATH:$ORACLE_HOME/bin:/usr/bin:/bin

Now we need to setup the mount points where the oracle software is going to be installed. I am lucky enough to have four disks which means that I can utilise three of these disks for just for oracle. Oracle recommends the use of at least three disks so that you can keep multiple control and redo log files all of which are on seperate disks. There are very good reasons for doing this which will be explained later.

I have the following oracle related entries in my /etc/fstab file. Oracle is not fussy about what filesystem you choose to use. Oracle can also use raw partitions but this is beyond the scope of this tutorial.

		/dev/hdb1               /opt/oracle/oradata/ide11   ext3        defaults        0 0
            	/dev/hdd1               /opt/oracle/oradata/ide21   ext3        defaults        0 0
            	/dev/sda2               /opt/oracle/oradata/scsi02  ext3        defaults        0 0

We now need to create several files and directories some of which we specified in /etc/fstab and some others in /home/oracle/.bash_profile. We need to be logged in as root to do this.

		mkdir -p /opt/oracle/product/
            	mkdir /opt/oracle/oradata
            	mkdir /opt/oracle/oradata/ide11
            	mkdir /opt/oracle/oradata/ide21
            	mkdir /opt/oracle/oradata/scsi02
            	chown -R oracle.oinstall /opt/oracle

Now we need to get ready to run the installer. I prefer to copy the CD's to the hard disk to avoid having to remount them every time the installer needs another CD. Be aware that a lot of space is required to do this.

We need to log in as the oracle user for this part.

I first create three directories as follows

	        mkdir /home/oracle/Disk1
            	mkdir /home/oracle/Disk1
            	mkdir /home/oracle/Disk1

Then I can copy the files from the CD

		cp /mnt/cdr/lnx_920_disk1.cpio.gz /home/oracle/Disk1
            	cp /mnt/cdr/lnx_920_disk1.cpio.gz /home/oracle/Disk2
            	cp /mnt/cdr/lnx_920_disk1.cpio.gz /home/oracle/Disk3

We now need to decompress and unpack the files.

		zcat /home/oracle/Disk1/lnx_920_disk1.cpio.gz | cpio -idmv
            	zcat /home/oracle/Disk2/lnx_920_disk2.cpio.gz | cpio -idmv
            	zcat /home/oracle/Disk3/lnx_920_disk3.cpio.gz | cpio -idmv

This may take a few minutes Now we can run the Installer. Do not do this as root. This must be done as the oracle user created earlier.


This command will launch the Oracle Universal Installer (OUI). During the install you can select the "Help" button to get an overview of screen of the OUI. The OUI is very good but unfortunately the install procedure is not flawless. The version of Oracle that we are installing suffers from a few minor bugs that I will detail as we go along. The OUI can also be used to deinstall Oracle. I recommend using the OUI rather than just deleting various files when deinstalling Oracle. Be aware that some of the steps may take some time.

Follow these steps: (The following is a point and click install procedure)

On the first window to appear Select the "Next" button to continue. The Following window will ask you for a base directory for the install. If you have set up the environement variables as detailed earlier then the default should be fine. Select "OK" to continue.

The next window will ask you for the unix group name that is allowed to update the oracle software on your system. We created the "oinstall" group earlier for this purpose so type in "oinstall" here and select "Next" to continue.

We will then be prompted to run /tmp/ as root. Use

		su  -c  /tmp/

to log in as root and execute the command. After running this file select "OK" to continue

The next window contains three fields all of which should be filled in if your environement variables have been set correctly. The second of the two PATH fields should be the location as specified in your "ORACLE_HOME" environement variable. Select "Next" to continue.

The next screen should give us some choices of things to install. We want to install the Oacle database which should be checked by default. Select next to continue.

We want to install the Enterprise edition. This option should also be selected by default. Select next to continue.

We are going to use the general database option which should be selected by default. Select Next to continue. This task may take a few minutes.

The next window asks you for a global database name. In my case I entered If you have a domain name I suggest that you use it. The "SID" field should already be set to whatever you set the SID environement variable in /etc/.bash_profie. In my case this is "mynewdb". Select next to continue.

The next window asks you where you want to install the oracle files. The default is OK here. Select Next to continue.

The next window asks you which character set to use. For simplicity use the default setting and select next to continue.

The next window gives you an exhaustive list of what is about to be installed. Select "Install" to continue. This step takes the longest and for me took approximately 20 minutes.

Near the end of the install you will be asked to run the "" script as root. When you run the script you will be asked for the local bin directory. The following is the output from this script. Select the "OK" button to continue.

            []# /opt/oracle/product/ 
            Running Oracle9 script...
            \nThe following environment variables are set as:
                ORACLE_OWNER= oracle
                ORACLE_HOME=  /opt/oracle/product/

Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/local/bin

               Copying dbhome to /usr/local/bin ...
               Copying oraenv to /usr/local/bin ...
               Copying coraenv to /usr/local/bin ...
            Adding entry to /etc/oratab file...
            Entries will be added to the /etc/oratab file as needed by
            Database Configuration Assistant when a database is created
            Finished running generic part of script.
            Now product-specific root actions will be performed.

The database creation assistant (dbca) is a very useful tool for people wishing to install a database. Oracle DBA's normally will sometimes create a database from scratch or use the dbca tool to create a base database then configure the database after it has been created. I have had numerous problems when using dbca so now I prefer to create the database using a shell script. If anyone is unable to get dbca to work on their system one of the main causes is the sharead memory settings. Increasiing shmmax sometime cures the problem but more often than not it wont. In the cases where it does not sure your problem I can provide you with simple shell script to create the database. The scipt will need to be edited for your system but it is pretty simple to do this.

Where to go from here

For further information on the oracle install I recommend their own documentation. They assume a flawless install and I can assure you that all the problems I have encountered to date can be attributed to wrong versions of pre-installed software, not deinstalling Oracle properly before trying another install and shared memory settings. If you have a bug you are not sure about and you have searched google and read the docs the you can email me on harry at