Installing Oracle XE on Debian AMD64

First install 32 bit libs:

sudo aptitude install ia32-libs

Check that you have libaio (it should be part of newer versions of ia32-libs) :

rkitover@caelum ~/tmp/libaio % ls -l /emul/ia32-linux/lib/libaio*          
lrwxrwxrwx 1 root root   15 2009-02-15 09:17 /emul/ia32-linux/lib/ ->
-rw-r--r-- 1 root root 2752 2007-09-10 18:37 /emul/ia32-linux/lib/

If you don't have it, install it:

mkdir libaio
cd libaio
ar -x libaio1*.deb 
tar zxvf data.tar.gz 
sudo cp lib/* /emul/ia32-linux/lib/

Create an Oracle Technet login if you don't have one yet at

Grab the i386 XE Universal .deb from, you'll need to sign in with your Technet login.

Install the .deb:

dpkg --force-architecture -i oracle-xe-universal_10.2.0.1-1.0_i386.deb

Now configure it:

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

Make sure not to Ctrl+C out of the config script, or you will be fucked. If that happens, purge and reinstall.

Your Oracle server is now up and running!

Now you need a 64bit client, go to and grab the "basic lite", "SQL*Plus" and "SDK" instantclient .zip files.

The version doesn't matter, but I use 10.2.

Unzip them all into your user's home directory. Use another location if the installation will be shared amongst users. You should now have an "instantclient_10_2" directory (with the postfix being the version you installed.)

Now you need to link to the server's tnsnames.ora :

cd instantclient_10_2 
mkdir -p network/admin
cd network/admin 
ln -sf /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/tnsnames.ora .

Now set some environment variables in your ~/.bashrc :

export ORACLE_HOME=~/instantclient_10_2
export XE=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export LD_LIBRARY_PATH=~/lib:/lib:/usr/lib:/usr/local/lib:~/instantclient_10_2:$XE/lib
export PATH=~/bin:~/instantclient_10_2:$XE/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/bin/X11:/usr/games  
export ORACLE_USERID='hlaghdb/dongs'
export ORACLE_DSN='dbi:Oracle:XE'

Source it or relogin for the next step.

These settings will work correctly for installing DBD::Oracle.

Now your client is configured, but you still need a schema.

sqlplus system/<the-system-password-you-configured>@XE
create user hlaghdb identified by dongs;
grant create session, resource to hlaghdb;

Normally you'd create a tablespace too, but that's a little more advanced, and for the purpose of playing with Oracle this should be more than sufficient.

Now you can connect with to Oracle with:

sqlplus hlaghdb/dongs@XE

See also for how to add readline support to sqlplus.

Last modified: 2017-1-8 (日) at 9:14 pm