Monday, February 8, 2010

Building TOra with Oracle support on Ubuntu

I'm doing some Oracle development, so I wanted to use the TOra db browser for convenience.

TOra is Free Software. There is a license conflict between TOra and the license that Oracle use on their client libraries. As a result TOra is not distributed with Oracle support: if you want to use TOra with Oracle, you must download the separate components, TOra source and Oracle client, and build TOra yourself.

This process is documented on the web, notably at pythian blog. However the instructions are for Ubuntu 9.04, and I'm using 9.10, so I thought there is an opportunity to document my experience as well.

So, on Ubuntu 9.10, I have installed Oracle XE (a resource-limited 10G installation), into it's default directory: /usr/lib/oracle/xe/

I'm also assuming that you, like me, have the three Oracle packages oracle-instantclient-basic- oracle-instantclient-devel- oracle-instantclient-sqlplus- installed in their default location: /usr/lib/oracle/

NOTE: I chose the '10.x' client packages - I'm not sure if this makes a difference.

It seems that the Ubuntu source for TOra have migrated to git, so when I tried to pull down the source using apt-get source I didn't have any joy. So I cloned the TOra git repository and attempted to modify the debian/rules file to include the relevant Oracle libraries. This wasn't possible - there were no configure rules in there...

So instead I configure using 'cmake'.
First I need to configure: ORACLE_HOME and LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=/usr/lib/oracle/
export ORACLE_HOME=/usr/lib/oracle/

I also need to install the old libstdc++5 which is available from the Debian repository:

Then a command line to configure build:

 fakeroot cmake -DORACLE_PATH_LIB=/usr/lib/oracle/ -DORACLE_LIBRARY_CLNTSH=/usr/lib/oracle/ -DORACLE_LIBRARY_OCCI=/usr/lib/oracle/ -DORACLE_INCLUDES=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/public

NOTE: I'm calling in the INCLUDES from the XE install.
...and another to build:


And you should know what to do from here...