个人工具

UbuntuHelp:TOraOracleSetUpHowTo

来自Ubuntu中文

跳转至: 导航, 搜索


Installing tOra with Oracle Support

I couldn't find an appropriate page specific to Ubuntu for installing tOra and having Oracle support built-in for usage. If you install tOra for Debian or Hoary, you'll only get the MySQL and PostgreSQL connectors. After hacking away a bit at the problem, I came up with a somewhat ok solution. Much of this How-To will be built around the INSTALL included in the tora-1.3.16 (latest at this time of writing) distribution. Much of this will be copied word-for-word until the Hoary-specific instructions below.

Installing Oracle InstantClient

From tOra's INSTALL documentation:

Documented steps tested on Debian linux (testing). It should
work on other Linux distributions, but some (system) filenames
may differ.

1) Oracle instant client
Download client (http://www.oracle.com/technology/software/tech/oci/instantclient/index.html)
choose your platform (linux x86) and then you download "Instant Client Package - Basic",
"Instant Client Package - SQL*Plus", "Instant Client Package - SDK".
Because Debian does not use rpm packages, I used zip archives. After
unzip in appropriate directory (/usr/local/oracle/instantclient10_1)
you need this step to do (some as root, some as oracle user):
a) edit /etc/ld.so.conf (add /usr/local/oracle/instantclient10_1)
b) in /usr/local/oracle/instantclient10_1 create symbolic link:
   ln -s libclntsh.so.10.1 libclntsh.so
c) run ldconfig
d) provide tnsnames.ora
e) create dir bin (/usr/local/oracle/instantclient10_1/bin) and 
   symbolic link to sqlplus in bin: (ln -s ../sqlplus)

Apart Oracle's documentation, you do not need to set LD_LIBRARY_PATH.

Test connection using sqlplus. When succesfull, set environment
variables for users, who will compile tora and use tora:

ORACLE_HOME=/usr/local/oracle/instantclient10_1
TNS_ADMIN=<path_to_dir_where_is_tnsnames.ora>

Things to note:

  • Oracle is now on 10.2, so your instant client downloads should be in the form of instantclient_10_2.
  • I also ran (in the instantclient directory):
sudo ln -s libocci.so.10.1 libocci.so

Compiling tOra from Source

  1. Download the latest version of tOra from http://tora.sourceforge.net/
  2. Explode the tarball into a directory of your choice (I will assume /tmp/tora hereafter).
  3. From tOra's INSTALL documentation:
Before you try to compile TOra you will need the following prerequisites:

1. A unix system which supports Qt.
2. Qt 2.2 or later. Requires an interface compiler of at least version 3.0.
3. Oracle 8i (At least Oracle 8.1.5), it might work partially with earlier
   versions of Oracle but is as of this version not supported (Please try and
   send me patches).
4. PERL 5.
5. GNU Make.

Thats about it, you should be set to start trying.

Hoary-Specific requirements

  1. In order to build, you will need the development packages for libqt. The correct package for this install is libqt3-mt-dev, the multi-threaded libraries for Qt. Any other libqt*-dev package will not provide you with MySQL and PostgreSQL after installation.
  2. Here are some additional things I did (at this point) in my environment as a bit of trial-and-error. I don't know if these have any sway in the end-result, so feel free to experiment and add your results.
  • Downloaded and installed the libmysqlclient12-dev package.
  • Downloaded and installed the postgresql-dev package.
  • I had set ORACLE_HOME and TNS_ADMIN in my environment during configure and make.
  • I also ignored the tOra INSTALL doc and added /usr/local/oracle/instantclient_10_2 to my LD_LIBARY_PATH.
  1. Using libqt3-mt-dev on my system, configure will blow itself up looking for qt libraries to link with. I could not find the right combination of --with-qt-* parameters to force the configure script to use the multi-threaded libs, so I patched the script directly. So Step #2 is copy and paste the below code into a file, I'll call it: /tmp/tora/configure.pl.diff.
configure.pl.diff
278c278
< my $QtSearch="libqt(?:-mt)?";
---
> my $QtSearch="libqt-mt";
681c681
< 						    ($lib,$QtLibShared)=($file=~/^(.*)\/lib(qt(?:-mt)?3?)[^\/]*$/);
---
> 						    ($lib,$QtLibShared)=($file=~/^(.*)\/lib(qt3?-mt)[^\/]*$/);
718c718
< 							 ($QtLibShared)=($_[0]=~/\/lib(qt(?:-mt)?3?)[^\/]*$/);
---
> 							 ($QtLibShared)=($_[0]=~/\/lib(qt3?-mt)[^\/]*$/);
901c901
<     findFile("^libqt(-mt)?3\\.a",sub {
---
>     findFile("^libqt3?-mt\\.a",sub {
923c923
< 	findFile("^libqt(-mt)?\\.a",sub {
---
> 	findFile("^libqt-mt\\.a",sub {
1529c1529
< 	kdoc -n $ProgramName -d help/api \$^ -lqt -lkdeui -lkhtml
---
> 	kdoc -n $ProgramName -d help/api \$^ -lqt-mt -lkdeui -lkhtml
  1. Save the file. Then patch configure with the following command (in the /tmp/tora dir):
patch -p0 configure.pl configure.pl.diff
  1. Now configure, make, and make install. (Note, this will install everything in their respective dirs in /usr. Your regular --prefix, --prefix-bin, and --prefix-lib will do the trick in configure if you want to install elsewhere.
./configure
make && make install
  1. Once that's completed (and it takes a surprisingly long time), make sure your environment variables are set correctly (TNS_ADMIN, in particular), and run tOra.
tora &

Test Your Install

Once you've completed and tOra is loaded, check your upper left hand corner of the "New Connection" window. In the drop-down, you should have Oracle listed and if everything went swimmingly, you should have MySQL and PostgreSQL as well. BTW, if something went horribly wrong, a dialog will come up saying something to the effect of "No connectors provided." And then tOra will die a horrible death.

Uninstallation

If you need to uninstall tOra, uninstall is a valid make target and does do what it implies. So if something goes wrong and you just want to reverse the damage done, type:

make uninstall