Hello guys, its been more than 8 months since i published my last article. Sorry for the delay.

Lately, I have been facing a problem which i am sure many of us faced once in a while and that’s “How to \”Successfully\” install Oracle Express Edition on ubuntu 14.04″. Well let me tell you one thing straight, its not as easy as installing oracle in windows and lots of article out there tell you the same thing and this article is not standing out. But i tell you things from my perspective and the problems i faced and how i successfully install oracle.

Firstly, download oracle express edition from here. (You probably need a free oracle account in case if you don’t have one). After downloading the RPM file, first you need to place it in some other base folder where all your oracle directories reside. So copy paste it from downloads to your /home/basefolder.

First thing you need to learn is that the downloaded file is in RPM format and your ubuntu uses .deb (Debian) format, So you need to convert RPM package to .deb Package.

In order to convert RPM package to .deb package you most probably need alien software program written by Joey Hess. It converts between  LSB (Linux Standard Based) , LSB based RPM packages , .deb Packages and solaris (.pkg) and many more. Just install the package by following command (in case you don’t have one)

sudo apt-get install alien 

After installing alien and copying oracle RPM package to some base folder just unzip that package using  unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip.

After unzipping oracle zip file , Disk1 named folder is created which contains your RPM package of oracle. So type in:

cd Disk1

Now you need to convert this RPM package to .deb package, for this just type in:

sudo alien –scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm

This command converts your RPM package to .deb package. (Note that this command takes some time to execute, so you have to wait for some time. Meanwhile you can proceed to other tasks).

Now create a file in /sbin/ folder named as chkconfig and paste following in that file:

#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Ubuntu
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
echo >> $file
echo ‘### BEGIN INIT INFO’ >> $file
echo ‘# Provides: OracleXE’ >> $file
echo ‘# Required-Start: $remote_fs $syslog’ >> $file
echo ‘# Required-Stop: $remote_fs $syslog’ >> $file
echo ‘# Default-Start: 2 3 4 5’ >> $file
echo ‘# Default-Stop: 0 1 6’ >> $file
echo ‘# Short-Description: Oracle 11g Express Edition’ >> $file
echo ‘### END INIT INFO’ >> $file
fi
update-rc.d oracle-xe defaults 80 01

Save above file and provide following privileges:

sudo chmod 755 /sbin/chkconfig

Next step is to set some kernel parameters

sudo gedit /etc/sysctl.d/60-oracle.conf

After executing above command a file named 60-oracle.conf opened in gedit. Add following lines in it and then save it.

# Oracle 11g XE kernel parameters  
fs.file-max=6815744  
net.ipv4.ip_local_port_range=9000 65000  
kernel.sem=250 32000 100 128 
kernel.shmmax=536870912
Here one thing should be considered first, your computer’s swap size.Minimum swap space requirement of Oracle 11gR2 XE is 2 GB . You can check your computer’s memory swap size by free -m.
Now Make some more changes by executing following commands:
sudo ln -s /usr/bin/awk /bin/awk
mkdir /var/lock/subsys
touch /var/lock/subsys/listener
Now you are ready to install Oracle 11gR2 in your computer. Just go to your base directory where your .deb file resides by
cd /home/baseFolder/
and execute following command:
sudo dpkg –install oracle-xe_11.2.0-2_amd64.deb
After installing oracle, you need to configure it. (Yeah you read that right, you need more configurations to make it work). You need to execute following command to configure oracle 11g R2:
sudo /etc/init.d/oracle-xe configure 
After executing this command,  some questions appears on the screen, and you need to provide these basic configurations
1. A default HTTP port for Oracle Application Express. In case just provide default which is 8080.
2.  A valid port for the Oracle database listener . In case just provide the default which is 1521.
3.  A password for the SYS and SYSTEM administrative user accounts. You need to remember this password as you will need it later on.
4. Confirm password for SYS and SYSTEM administrative user accounts.
5. Whether you want the database to start automatically when the computer starts.
Now you need to setup some environment variables. Just open your .bashrc by following command:
sudo gedit ~/.bashrc
After your .bashrc file is opened in gedit, add following lines to it:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
After all this pain, you need to restart your PC. After restarting you need to start your oracle Database by:
sudo service oracle-xe start
If all went well, then your oracle database starts and prints following message on console:
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
Now all you need to connect to SqlPlus, Just type in sqlplus in your console and your console appears as:

SQL*Plus: Release 11.2.0.2.0 Production on Tue Jul 5 00:14:10 2016

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Enter user-name:

Here you need to provide your system username as sys as sysdba and password which you entered above during configuration step and if all went well following screen appears:
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 – 64bit ProductionSQL>

Now you need to create user and grant some privileges to it.
In case you missed some steps or you are having some error, all you need to do is go through above steps again and again after uninstalling oracle until you succeed.
Chao..!!

 

Advertisements