Refer to: http://gm.matias.ph/running-oracles-sql-plus-in-linux-ubuntu-2010-08-04
SQL*Plus is an Oracle command-line utility program that can run SQL and PL/SQL commands interactively or from a script. Programmers and DBAs commonly use it as the default available fundamental interface in almost any Oracle software installation.This is a howto to use Oracle's SQL Plus application to access Oracle database without installing the Oracle software suite.
- Create an account with Oracle to be able to download the required files. It's free. If you already have one, then proceed to the next step.
- Download two .rpm packages from Oracle.
-
32-BIT VERSION:
Linux x86 (32-Bit)
64-BIT VERSION: Linux x86-64 (64-Bit) - Select the version of Oracle that you prefer to use.
- Instant Client Package - Basic All files required to run OCI, OCCI, and JDBC-OCI applications
- Instant Client Package - SQL*Plus Additional libraries and executable for running SQL*Plus with Instant Client
- Install the application alien to convert the .rpm packages to .deb which is the required format by Ubuntu. Install it by executing:
1
$
sudo
apt-get
install
alien
- Go to the folder where the .rpm packages are located.
1
$
sudo
alien -k oracle-instantclient*.rpm
- The .deb packages are ready to be installed.
1
$
sudo
dpkg -i oracle-instantclient*basic*.deb
2
$
sudo
dpkg -i oracle-instantclient*sqlplus*.deb
- Add the library to classpath. The library files are installed in the system but are not set to be found by SQL Plus. To do this, create an environment variable called LD_LIBRARY_PATH in order for SQL*Plus to locate them.
1
$
export
LD_LIBRARY_PATH=/usr/lib/oracle/@@version@@/@@client@@/lib
- To make sure that the library is always exported. Put the exported line to /.bashrc} located in your home directory.
1
$ gedit ~/.bashrc
- Install another dependency needed by SQL Plus.
-
For Ubuntu 9.1:
1
$
sudo
apt-get
install
libaio
1
$
sudo
apt-get
install
libaio1
- Delete the .rpm and .deb files.
Troubleshooting:
- libsqlplus not exported.
1
sqlplus: error
while
loading shared libraries: libsqlplus.so: cannot
open
shared object
file
: No such
file
or directory
2
libaio not available.
1
sqlplus: error
while
loading shared libraries: libaio.so.1: cannot
open
shared object
file
: No such
file
or directory
- Startup error about unknown tags. Just ignore this.
1
error: incorrect
format
: unknown tag
For both cases, please follow the last two steps of the instructions.
Updated (25.2.2010):
- Different libaio package name for Ubuntu 10.4.
- Thanks for the tips, in Ubuntu 10.4 I must type:sudo apt-get install libaio1instead ofsudo apt-get install libaio