The Oracle Database, also known as Oracle RDBMS is a 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 very robust database solution.
Of course Oracle is a non-free software, and might not be well really liked by free software purists, and its corporate versions and support cost a bomb, but to be fair Oracle does offer a free Express Edition for its somewhat older 10g release, more popularly known as Oracle XE 10g. It’s a free download and is available for variety of platforms including various distros of Linux and Microsoft Windows.
In this tutorial, we will discuss on setting up and configuring Oracle XE 10g in Ubuntu. Here I’ve used a 32 bit version of Ubuntu 9.10 for this purpose, but these instructions will easily work for previous or future iterations of Ubuntu.
First of all we download Oracle 10g XE from Oracle website. I suggest to download from the Oracle’s Debian Repos directly, here. Select the Universal or the standard package for Oracle. Note the client is bundled with the Oracle Software itself, so no need to install it separately. Of course if you wish client alone for connecting to an Oracle software, you may proceed to install it as any Debian package.
Note you need enough RAM for Oracle in your system. If you have less than 1GB RAM, then you need to create more a gig of swap in the system by:
sudo dd if=/dev/zero of=/swpfs bs=1M count=1000
sudo mkswap /swpfs
sudo swapon /swpfs
Also you have to download the libaio package, which is necessary for installation of Oracle. Note DEB packages may open directory in Firefox, so use “Save Link As…” in that case.
Note all these packages are 32bit packages, and there’s no 64 bit packages for any Oracle XE. However you can conveniently install the 32 bits packages in a 64 bit system as we will highlight further.
Download and save the packages in some convenient directory, say $HOME/Downloads, and then fire up the terminal and change to the directory containing the packages.
First install libaio package:
sudo dpkg -i libaio_0.3.104-1_i386.deb
Next up install the Debian package for Oracle 10g XE:
sudo dpkg -i oracle-xe-universal_10.2.0.1-1.1_i386.deb
NOTE: For 64 bit users they need to install ia32-libs package first and then install by forcing architecture.
sudo apt-get install ia32-libs
And the packages are installed by –force-architecture switch.
sudo dpkg -i --force-architecture libaio_0.3.104-1_i386.deb
sudo dpkg -i --force-architecture oracle-xe-universal_10.2.0.1-1.1_i386.deb
Now you need to set up Oracle XE for use:
sudo /etc/init.d/oracle-xe configure
Here the installer will ask a variety of questions, I suggest just to accept the defaults. Just make sure you don’t forget the password you’ve set during this configuration. Also take note the setup will ask whether you’ll want Oracle XE to start on boot or not. Use it as your convenience. Remember if you set it not to start at boot, then you’ll have to start Oracle every time when Ubuntu boots.
This setup procedure may take several minutes, so please exercise patience during this.
After this process gets complete, try visiting the page: http://127.0.0.1:8080/apex to access Oracle Database Home Page. Note if you had set a different port, use it instead of 8080. If you can see Oracle Database page, then congratulations Oracle has been set up on your system.
Here you can access for administration by SYS username and the password you’ve set as the password. Here you can administer various parts of the Oracle Database system, including unlocking the sample hr username which has password hr and is locked by default.
There is more to set up the proper functioning of Oracle in the system. $ORACLEHOME environment variable has to be set for proper functioning of console applications. You need to set it up.
gksudo gedit /etc/bash.bashrc
Now scroll to the bottom of page and add the following lines:
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE
export PATH
Now you can simply use sqlplus by command:
sqlplus
You can log in as the DBA by
sqlplus sys as sysdba
More details are available in Oracle Documentation.
It’s highly recommended to use rlwrap over SQLPlus so that SQLPlus is more tolerable to use since it facilitates command line history.
Install rlwrap.
sudo apt-get install rlwrap
Run SQLPlus with:
rlwrap sqlplus
Good Luck with your Oracle Adventure.
|
|
|
|
|
|
|
|
|
|
|
David Truog
May 29, 2010 at 9:17 am
This overwrites the libaio 64bit which breaks the virtualbox extensions if you use a virtualbox client and a few other things. It seems you can install both the 64bit and 32bit versions in RHEL – is there a way to do this in ubuntu?
Scott
June 7, 2010 at 5:18 pm
Thank you so much
MHMH
June 19, 2010 at 10:52 am
Thank you very very very much
Gaurav aka GeekG
June 19, 2010 at 5:25 pm
Pleasure to hear that
Bennie Ekstrum
June 21, 2010 at 6:19 am
Great blog post.Really looking forward to read more.