Oracle and TOra on Ubuntu Hardy
Please note, I’ve migrated all my posts, including this one, to a new location.
I work with Oracle a lot in my 9 to 5 existence so I like to have a setup that I can make mistakes on at home. It’s also cool to have a powerful open source tool like TOra at your disposal. I’ve found that it’s easy enough to get them both set up on Ubuntu Hardy.
Oracle (perhaps with one eye on MySQL and Postgres) started giving away binaries of their express edition a few years ago. There are restrictions on how large a database can be and it’s not free as in ‘freedom’ but it does allow you to brush up on Oracle specific features.
Installation is pretty straightforward. If you’re running a Debian based distro (like Ubuntu) you can get Oracle up and running by doing the following. First add their repository to your sources.list. Create a file named “/etc/apt/sources.list.d/oracle.list” containing the following line:
deb http://oss.oracle.com/debian unstable main non-free
Add their key:
# wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add -
Update and install:
# sudo apt-get update
# sudo apt-get install oracle-xe oracle-xe-client
After the install is complete, you need to run the configuration script:
# sudo /etc/init.d/oracle-xe configure
You will be asked a few questions. The default values are probably suitable though you might want to think about whether you want the db server to start at boot (I prefer to start it manually when required). Once completed, you should be able to log into the browser based management tool at http://127.0.0.1:8080/apex (substituting the port number if you chose something other than 8080).
You probably want to add these few lines to your .bashrc in order to make life easier.
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
Start a new shell or source your .bashrc and you should have useful tools such as sqlplus in your path. At this point it’s a good idea to test that your database server is up and running. Connect as SYSDBA using the password you set earlier and enable the basic user ‘HR’:
# sqlplus SYS as SYSDBA
SQL> alter user HR account unlock ;
SQL> alter user HR identified by $password ;
SQL> exit
Now you should be able to connect as user ‘HR’ and query the tables in the sample database:
SQL> select *
2 from countries
3 where country_id = 'UK';
Few programs frustrate me as much as sqlplus however and I’ve come to rely on the developer tool Toad. Happily, there is an open source equivalent to Toad, named TOra. It’s feature rich and uses many of the same key bindings as Toad and I’ve heard there was a shared history between the two applications.
It’s also available in the main Ubuntu repositories. There’s a slight problem however. For legal reasons, these packages haven’t been compiled with Oracle support. Yet with a few tweaks, it’s possible to recompile and package it yourself with Oracle support turned on using the libraries included in the oracle-xe-client package.
There are a couple of things you need to. First, Install packages required for building debs:
# sudo apt-get install build-essential fakeroot
Then download the TOra source and install packages required for building:
# apt-get source tora
# sudo apt-get build-dep tora
Now you need to tweak a few things. Make sure you set your $ORACLE_HOME environment variable, either through your .bashrc, or by doing the following:
# export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
Also, add the Oracle libraries to the paths checked by the linker by creating a file named /etc/ld.so.conf.d/oracle_xe.conf with the following line and running ldconfig:
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib
# sudo ldconfig
Next, you need to edit the file debian/rules in the TOra source package. Change the flags passed to configure to:
--prefix=/usr --with-oracle=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server --without-rpath --disable-new-check --without-kde --enable-libsuffix=
Also comment out the use of the dh_shlibdeps:
# dh_shlibdeps
This turns off shared library dependency checking for packages. This isn’t ideal but it will cause errors when building otherwise. I was a little bit uneasy about this but I came across this article that suggests doing so is sometimes necessary when packaging proprietary apps.
To actually build the package, change to the source package directory and run:
# fakeroot dpkg-buildpackage
It will take a few minutes, depending on your system, but you should see a deb created in the directory above where you ran the build command. You can install it with:
# sudo dpkg -i tora_1.3.22-5_i386.deb
You should now have TOra installed with Oracle support!
I noticed a couple of other things while playing with TOra. I didn’t have MySQL support by default until I installed the package libqt3-mt-mysql. You only need the package installed, there’s no need to re-compile TOra again. I was also struck by how nice it looked. I run Gnome and hardly ever use any Qt apps but I keep meaning to have a look at KDE4 and this was a reminder.
While I was exploring TOra, I also came across a similar project named CrunchyFrog. It’s written in Python and uses GTK. I ran into a couple of bugs but it looks promising. It uses a plugin architecture for handling connections to different databases. In theory you could simply install a plugin to handle connections to Oracle (or MySQL et al). In practice, I could only find a plugin for SQLite but it’s probably the excuse I’ve been waiting for to mess around with it. I got round to reading the manual. I’m still going to check out SQLite though.
All told, the future is bright for open source databases and tools and it’s nice to know that we’ve got the means to operate with Larry’s all pervasive product with a classy desktop app.
24 Comments so far
Leave a reply
Very nice, works like a charm !
Thank you very much
thank you, worked perfectly!!!
Thanks guys, I’m glad it helped. I need to work out how to pin it so that it doesn’t get upgraded though, but that’s for another day.
Does’nt work, please help me, When I try to compile get this:
focaranza@focaranza-laptop:/usr/src/tora-1.3.22$ fakeroot dpkg-buildpackage
dpkg-buildpackage: set CPPFLAGS to default value:
dpkg-buildpackage: set CFLAGS to default value: -g -O2
dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
dpkg-buildpackage: set FFLAGS to default value: -g -O2
dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
dpkg-buildpackage: Paquete fuente tora
dpkg-buildpackage: Versión fuente 1.3.22-5
dpkg-buildpackage: Fuente cambiadas por Michael Meskes
dpkg-buildpackage: arquitectura de anfitrión i386
debian/rules clean
debian/rules:24: *** las instrucciones comenzaron antes del primer objetivo. Alto.
dpkg-buildpackage: fallo: debian/rules clean gave error exit status 2
Regards
Hmmm, I’m not too sure and I can’t understand the Spanish error messages at a glance.
Are you running Hardy and did you do anything differently? Have you tried to build the package more than once? Perhaps you could download the source package again and start from scratch?
Yes I tried to rebuild the package more than once, but I reinstall the source, and now everything goes find.
Thank
Mmmm..not work, in CONNECTION PROVIDER just recognice PostgreSQL….any ideas….
Regards
Sorry if this is a stupid question, but did you make the necessary modifications to the fresh source package after downloading?
Of course, I made the changes as your guide … but even so only recognizes PostgreSQL.
Thank you
Alright, I’ll rebuild it when I get a chance and have a think
Now running Oracle happily with sqlplus etc — but a Linux newbie question.
At “you need to edit the file debian/rules in the Tora source package” …
How do I locate the Tora source package? Is there a conventional location - or is it specific to Tora?
Thanks for any help…..
ah!
I was searching for /src/tora and similar
and did not think to look in my ~ folder.
Well done westdale, it’s easy once you know how!
I seem to be in the same state as Daemon.
It took a couple of downloads and rebuilds before it took — at first it bombed as follows :
dpkg-source: unrepresentable changes to source
dpkg-buildpackage: failure: dpkg-source -b tora-1.3.22 gave error exit status 1
gareth@ubuntu-laptop:~/tora-1.3.22$
( I have log if of any interest )
Downloaded source again and reran - ran for an hour or two this time - completed, then I installed — seemed OK.
When I ran it said no service providers - so I downloaded the libqt3…mysql.
I now have PostgresSQL as the only provider.
( SQL+ and the web connection to 8080/apex are both working fine )
— just be sure I have put it in the right place, the edited lines of rules follow.
configure-stamp:
dh_testdir
# Add here commands to configure the package.
#GW# ./configure –prefix=/usr –without-oracle –without-rpath –disable-new-check –with-kde –enable-libsuffix=
./configure –prefix=/usr –with-oracle=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server –without-rpath –disable-new-check –without-kde –enable-libsuffix=
touch configure-stamp
will try another rebuild tonight.
same issue on rebuild
and I notice that Tora icons are missing ( right shape but all black ) - perhaps a clue to a missing link.
Icons are a red herring - they blank out when there is no connection.
Upgraded the RAM to 1G on this machine as I want to do other things at the same time as Oracle
Complete reinstall Ubuntu Heron; added an extra 256M of swap for Oracle to allow install.
Reinstalled xe and xe-client.
SQL+ now fails
…..
SQL> connect /
ERROR:
ORA-01034: ORACLE not available
ORA-27121: unable to determine size of shared memory segment
Linux Error: 13: Permission denied
Any ideas? - other people with this error seem to have been doing arcane things, so no help from the web!
Deinstalled oracle-xe and -client (fully); reinstalled -xe only (no xe-client).
SQL+ is now working again from Terminal.
Seems to be some sort of conflict in the installs? As I did not manage to get TOra to work I think I shall leave it there.
Hi there,
All went fine, but when trying to build the package I get the following message :
checking for oracle… /usr/lib/oracle/xe/oracle/app/product/10.2.0/server
checking oci works… configure: error: Couldn’t compile and run a simpile OCI app.
Try setting ORACLE_HOME or check config.log.
Otherwise, make sure ORACLE_HOME/lib is in /etc/ld.so.conf or LD_LIBRARY_PATH
make: *** [configure-stamp] Fout 1
dpkg-buildpackage: failure: debian/rules build gave error exit status 2
I have tried different paths to lib files but it was of no help.
I’m running Ubuntu 8.08 64Bit. Oracle works fine.
What can it be ?
Hi all,
I used this procedure to buid tora, but instead of the server, I used only the client deb binary.
I pointed my –with-oracle to the client directory.
It looks ok up to now, and the oracle option appears in tora… I still need to test against a server.
Regards,
Gael
By the way : there is a problem when recompiling the package from “dirty” sources, because a scripts wants to create a diff but includes the binaries then fails.
Quick workaround : remove the tora source directory, and
tar -zxf tora-version.tar.gz
cd tora-….
zcat ../tora-version-subversion.diff.gz | patch -p1
will recreate the source directory, without the binaries but WITH YOUR CHANGES (as this files are refreshed in the compile process, precisely at the same point that fails and we are working around), and allow a clean recompile.
Regards,
Gael
I followed all step in this guide whitout any errors
but no oracle support find when i execute tora
I try for 3 times to repeat this procedure but no effect.
Thank you and sorry for my english.
Hi there,
I am newbie to Ubuntu, and TOra. But I have spent significant time testing both TOra_1.3.21pre22-2ubuntu1 & TOra_1.3.22-5.
I started with TOra_1.3.21pre22-2ubuntu1 and things worked fine. I lost Oracle provider when I upgrade to 1.3.22-5 through Upgrade Manager. I am not sure if the upgrade removed all the oracle client, but I did tora rebuild regardless with 1.3.22-5’s source. Still can’t get the Oracle provider back. Secondly, I updated Oracle client too, changing between Oracle 10g vs Oracle XE. Still failed to get Oracle in Tora.
So, I rolled back to Tora_1.3.21pre22. Tested with both Oracle 10g and Oracle XE clients. Both works (ie I get Oracle Provider in Tora_1.3.21pre22 and connect successfully).
Still not sure what differences between the old/new versions. But I am just glad that it works now.
On another note, I keep getting prompts from Update Manager about Tora_1.3.22 software update (even after I install the exact new version). May be it is a bug which tora needs to fix, but for now how do I get rid of the prompts and where do I see/update the software database?
Thanks.