Pages

Tuesday, April 13, 2010

Oracle on ubuntu

1 Why Ubuntu?

Ubuntu is a recent distribution that continualy evolve. Its based on another distribution: Debian. So we have for example the packet system that have made it famous: apt-get. Ubuntu's advantage is it capacity to evolve quickly, a new stable version is released every 6 months, it « user-friendly » orientation, it philosophy (I let you discover more on this distribution to this address: http://www.ubuntulinux.org), and more generaly the GNU/Linux philosophy that we don't detail here.

The actual stable version is the 5.10 « Breezy Badger » version.This distribution is Desktop orientated. You could use it as a server distribution too, it's not a problem. The next version will be the 6.06 « Dapper Drake » and it'll have a professionnal and a server version.

But you'll ask me something: If Ubuntu is easy as I said, why create a How To on it? As a matter of fact, Oracle have modify it installer for unallowed some distribution. So Oracle cannot be installed, but there is a tips.

2 Before the installation
2.1 Downloading, libraries installation

First, we have to get the Oracle 10g RC2 installer for Linux. You have to go on the Oracle site: http://www.oracle.com and download it (you'll have to register) Then type this line to install the necessary libraries :

sudo apt-get install gcc, make, binutils,libmotif3,lesstif2,rpm,libaio,zip

After the download, we have to unzip the archive file that we have download:

unzip fichier_d'installation_oracle.zip

2.2 Red Hat simulation

The first thing to do in the system's preparation is to simulate a Red Hat distribution. Don't worry, it's not difficult when you follow the guide. The Red Hat is differenciated by Ubuntu in the directory architecture. So we'll create some symbolic link to simulate the Red Hat architecture:

sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /usr/bin/basename /bin/basename
sudo ln -s /etc /etc/rc.d

To finish with this step, we have to create a file /etc/redhat-release that countain the information of the Red Hat system, this file is scanned by the installer and if it doesn't exist or if the information countained are wrong, the installer will not work:

sudo gedit /etc/redhat-release

Copy/Paste the following text:

Red Hat Linux release 3.0 (drupal)

2.3 Users / groups Oracle's creation and some modification

This will simply create the system requirement:


sudo userdel nobody
sudo groupadd oinstall
sudo groupadd dba
sudo groupadd nobody
sudo useradd -g oinstall -G dba -p passwd -d /home/oracle oracle -s /bin/bash
sudo useradd -g nobody nobody

Now, we create the directory where Oracle will be installed

sudo mkdir -p /u01/app/oracle
sudo mkdir -p /u02/oradata
sudo chown -R oracle:oinstall /u01 /u02
sudo chmod -R 775 /u01 /u02

At the end of /etc/security/limits.conf add the following:


* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536

In the file /etc/pam.d/login, /etc/pam.d/su uncomment the following:

session required /lib/security/pam_limits.so

Add this line to /etc/profile

if [ $USER = "oracle" ]; then
ulimit -u 16384 -n 65536
fi

Add the following lines to the end of /home/oracle/.bashrc (open it in root or oracle user):


umask 022
PATH=${PATH}:/u01/app/oracle/oracle/product/10.2.0/db_1/bin/

ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1/
ORACLE_SID=orcl
ORATAB=/etc/oratab
ORACLE_HOME_LISTNER=$ORACLE_BASE
ORACLE_BASE=$ORACLE_HOME

export ORACLE_BASE ORACLE_SID ORATAB ORACLE_HOME ORACLE_HOME_LISTNER

The system is now correctly configurated. Well going to the next step.

Launch a terminal and execute the following:

cd your_database_dir
xhost +
sudo su
su oracle
ORACLE_BASE=/u01/app/oracle
ORACLE_SID=orcl
export ORACLE_BASE ORACLE_SID
unset ORACLE_HOME
unset TNS_ADMIN
ORATAB=/etc/oratab
umask 022
./runInstaller

Open a terminal and do (in our case)

sudo /u01/app/oracle/oracle/product/10.2.0/db_1/oraInventory/orainstRoot.sh
sudo /u01/app/oracle/oracle/product/10.2.0/db_1/root.sh