How to Install Oracle Database Express Edition 11gR2 on Ubuntu Server 12.04

Oracle is a RDBMS (relational database management system), which is produced and marketed by Oracle Corporation. The Oracle Database Systems is one of the most popular database systems, competing with likes of MySQL, PostgreSQL, IBM DB2,Sybase, Microsoft SQL Server among others. Oracle is a great choice for applications that require large, distributed databases.

Oracle Database Express Edition 11gR2 is free for download and is available for variety of platforms including various distros of Linux and Microsoft Windows without needing a license. in this this guide will help you how to install Oracle Database Express Edition 11gR2 on Ubuntu Server 12.04

Step-by-Step Installing Oracle Database Express Edition 11gR2 on Ubuntu Server 12.04 LTS

Step 1. Managing Swap partition. Oracle Database Express Edition 11gR2 may require up to a 2GB (2095100 KB) swap partition, Enter the following command in terminal to verify your swap space:

cat /proc/meminfo | grep -i swap

If you don’t have enough swap space, you can increase available swap space by the following guide to create and enable swap partiton, in this case I’ll create 1 GB swap file and loaded at startup, located in the /home directory

Login as root:

sudo -i

Create swap file on /home directory with following commands:

dd if=/dev/zero of=/home/swapfile bs=1024 count=1048576
mkswap /home/swapfile
swapon /home/swapfile
swapon -a

Create a backup of the original “fstab” file and add the new swap file:

cp /etc/fstab /etc/fstab.backup_`date +%N`
echo '/home/swapfile swap swap defaults 0 0' >> /etc/fstab

Logout from root and verify the new swap space:

exit
swapon -s

Step 1. Install additional software thats require Oracle 11g Express Edition

sudo apt-get install alien libaio1

Step 2. Download Oracle Database Express Edition 11gR2 via Oracle Official website, it require registration before downloading.

Step 3. unzip the downloaded file, then convert the Oracle Database Express Edition 11gR2 package installer to debian package

unzip oracle-xe-11.2.0.1.0.x86_64.rpm.zip
cd Disk1/
sudo alien --to-deb --scripts oracle-xe-11.2.0-1.0.x86_64.rpm

Step 4. Configure Awk and Chkconfig, The following needs to be set for compatibility:

sudo ln -s /usr/bin/awk /bin/awk
sudo mkdir /var/lock/subsys

Ubuntu uses different tools to manage services and system startup scripts. The “chkconfig” tool required by the Oracle installer is not available in Ubuntu. The following will create a file to simulate the “chkconfig” tool.

Login as root:

sudo -i

Copy and paste the following Script directly into the terminal to create a file chkconfig:

cat > /sbin/chkconfig <<-EOF
#!/bin/bash
# Oracle 11gR2 XE installer chkconfig, Only run once.
echo "Simulating /sbin/chkconfig..."
if [[ ! \`tail -n1 /etc/init.d/oracle-xe | grep INIT\` ]]; then
cat >> /etc/init.d/oracle-xe <<-EOM
#
### BEGIN INIT INFO
# Provides: OracleXE
# Required-Start: \\\$remote_fs \\\$syslog
# Required-Stop: \\\$remote_fs \\\$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Oracle 11g Express Edition
### END INIT INFO
EOM
fi
update-rc.d oracle-xe defaults 80 01
EOF

Logout form root:

exit

Set the file /sbin/chkconfig executable :

sudo chmod 755 /sbin/chkconfig

Step 5. Install Oracle Database Express Edition 11gR2 with the following commands:

cd ~/Downloads/Disk1
sudo dpkg -i oracle-xe-11.2.0-1.0.x86_64.deb

Run the following configuration script to create (clone) the database. Accept the default answers, including “y” to startup the database automatically, or modify as required.

sudo /etc/init.d/oracle-xe configure

To verify success, the procedure should end showing:

Starting Oracle Net Listener...Done
Configuring database...Done
Starting Oracle Database 11g Express Edition instance...Done
Installation completed successfully.

Step 6. Set a password for the Oracle account:

sudo passwd oracle

Step 7. Post-Installation, In order to use sqlplus and other tools, the Oracle account requires specific environment variables. The following will set these variables automatically at every Oracle login:

Login as the Oracle user:

su - oracle

Copy the default account skeleton files and add the Oracle env script to .profile:

cp /etc/skel/.bash_logout ./ 
cp /etc/skel/.bashrc ./ 
cp /etc/skel/.profile ./ 
echo "" >>./.profile
echo '. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh' >>./.profile

Step 7. Configure remote login. By default, the Oracle Database XE graphical user interface is only available at the local server, but not remotely. The following will enable remote logins:

Login as the Oracle user, then login as SYSDBA and run the following commands:

su - oracle
sqlplus / as sysdba
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
exit

Reference :

Tags: #Database #Oracle #Ubuntu Server 12.04

How to Upgrade Ubuntu Server 12.04 to Ubuntu Server 14.04 LTS
How to Upgrade Ubuntu Server 12.04 to Ubuntu Server 14.04 LTS
This tutorial will describes how to upgrade
  • Richard

    Have you actually tired this – there are issues throughout. Invalid commands, the creation of the chkconfig file doesn’t work, the su – i is invalid, the .deb package created is not as listed. I stopped at this point as there were too many issues that I couldn’t be confident that the result would be correct. Deeply disappointed.

    • Luis Fernando Carvalho Cavalhe

      Install that packages which allows you to install and manage .rpm packages on Ubuntu ( rpm and rpm-i18n) and install Oracle DB by .rpm pacakges.

      • http://twitter.com/josir josir

        Hi Fernando, what command do I have to use after installing those packages?

  • Tahir Kırar

    Not working

  • hlosukwakha

    I only started getting errors in Step 4 with the chkconfig script:

    tail: cannot open `/etc/init.d/oracle-xe’ for reading: No such file or directory

    I had no problem with $sudo -i it worked fine. The Oracle version changes after $sudo alien –to-deb –scripts so it is necessary to note the new version name and use it in $sudo dpkg -i oracle-***

  • Luis Fernando Carvalho Cavalhe

    Man, please! Just install rpm and rpm-i18n in your Ubuntu and install Oracle DB directly from rpm package…

  • zajjar

    There are too many bugs… but if you do this: http://www.len.ro/work/oracle-11g-release-2-xe-on-ubuntu-12-04/ everything will be ok.

  • Vidyadhar

    Nice Post. If you want to install Oracle Database 11g R2 Enterprise Edition on Ubuntu 12.04 follow below POST

    http://www.techienote.com/2012/06/how-to-install-oracle-database-11g-r2-on-ubuntu-12-04.html

  • Magik

    Greate article, you’ve saved my day, thank you! :)

  • http://twitter.com/josir josir

    I got “Package build failed; could not run generated debian/rules file” using alien. Could you provide any tip on how to fix this? I’m using Ubuntu 12.04.2 64 bits.

  • Aravind

    showing like this : can anyone help?
    Starting Oracle Net Listener…Done
    Configuring database…
    Database Configuration failed. Look into /u01/app/oracle/product/11.2.0/xe/config/log for details

    • Sanat

      Run the following commands and then try to configure the database.
      In my case it worked.

      rm /dev/shm
      mkdir /dev/shm
      mount -t tmpfs shmfs -o size=2048m /dev/shm
      ln -s /usr/bin/awk /bin/awk #small fix to eliminate some errors
      sysctl kernel.shmmax=1073741824

      • Prabha Karan

        Gud one..After running these commands installation is successfull

  • Feri

    fail… :-/

    oracle@ubuntu:~$ sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.2.0 Production on Wed Jan 15 05:30:34 2014
    Copyright (c) 1982, 2011, Oracle. All rights reserved.

    Connected to an idle instance.

    SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
    BEGIN DBMS_XDB.SETLISTENERLOCALACCESS(FALSE); END;
    *
    ERROR at line 1:
    ORA-01034: ORACLE not available
    Process ID: 0
    Session ID: 0 Serial number: 0

    SQL> startup
    ORA-01078: failure in processing system parameters
    LRM-00109: could not open parameter file ‘/u01/app/oracle/product/11.2.0/xe/dbs/initXE.ora’
    SQL>

    oracle@ubuntu:~/product/11.2.0/xe/dbs$ ls -la
    total 16
    drwxr-xr-x 2 oracle dba 4096 Jan 15 05:27 .
    drwxr-xr-x 26 oracle dba 4096 Jan 15 05:27 ..
    -rwxr-xr-x 1 oracle dba 2851 Aug 28 2011 init.ora
    -rw-r—– 1 oracle dba 1536 Jan 15 05:27 orapwXE
    oracle@ubuntu:~/product/11.2.0/xe/dbs$

  • Feri

    !! IN CASE OF ‘DATABASE CONFIGURATION FAILED’ (THIS) !!

    Starting Oracle Net Listener…Done
    Configuring database…
    Database Configuration failed. Look into /u01/app/oracle/product/11.2.0/xe/config/log for details

    —–
    TRY
    —–

    goto:
    /u01/app/oracle/product/11.2.0/xe/config

    execute:
    $ sudo rm -rf log

    and kill the Logs folder. Repeate the config!

    … cause the config step check “is there a LOG folder”, in case of yes the config tought there must be an error.

Must read×

Top