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-10.2.0.4-1.i386.rpm oracle-instantclient-devel-10.2.0.4-1.i386.rpm oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm installed in their default location: /usr/lib/oracle/10.2.0.4/client/

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/10.2.0.4/client/lib
export ORACLE_HOME=/usr/lib/oracle/10.2.0.4/client/

I also need to install the old libstdc++5 which is available from the Debian repository: http://packages.debian.org/lenny/i386/libstdc++5/download

Then a command line to configure build:

 fakeroot cmake -DORACLE_PATH_LIB=/usr/lib/oracle/10.2.0.4/client/lib -DORACLE_LIBRARY_CLNTSH=/usr/lib/oracle/10.2.0.4/client/lib/libclntsh.so.10.1 -DORACLE_LIBRARY_OCCI=/usr/lib/oracle/10.2.0.4/client/lib/libocci.so.10.1 -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:

make

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

2 comments:

pythianhudson said...

Hi Richard. Nice post. I wanted to mention that I have instructions up for 8.04, 9.04 and also for 9.10. The 9.10 instructions can be found at Installing TOra with Oracle Support on Ubuntu 9.10 (Karmic Koala).

龐克搖滾 said...
This comment has been removed by a blog administrator.