On my day to day work I have to deal with Oracle a lot! and since I am trying to use Ubuntu as my working environment I had to install a bunch of things one of them is SQL Plus. I like command line a lot and SQL plus is the best tool for Oracle so I had to have it.
The process is not so complicated. So let's start first you need to go to the
Database Instant Client page and download the one specific to your platform. This post is for 32 bit so you have to download the
Instant Client Downloads for Linux x86 one. It should be the same for the 54 bit though. From there you need to download these 2 rpm files:
- 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
If you want, you can download the SDK :
- Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client
Since these are rpm files we need to convert them to deb, in order to that we need to install the
alien utility
sudo apt-get install alien
Once that is done, go to the folder where the rpm files are located and execute the following
alien -i oracle-instantclient-basic*.rpm
alien -i oracle-instantclient-sqlplus*.rpm
alien -i oracle-instantclient-devel*.rpm
These commands will convert the rpm files on the fly and install them. Now you can test it by just typing
sqlplus on the command line. For sure it will complain about a couple of things. One of them maybe about a missing
libaio.so.1 . This one is easy, we just need to install it a simple
sudo apt-get install libaio1
The next error might be about missing libraries like
libsqlplus.so. The libraries are there but SQL Plus can't find them. We need to add them to our
PATH this is easy as well. We just need to create an
oracle.conf file inside
/etc/ld.so.conf.d/ so lets do that. I use vi because I like it, but you can use whichever editor you want to create the file.
sudo vi /etc/ld.so.conf.d/oracle.conf
then we add this:
/usr/lib/oracle/11.2/client/lib/
Notice that in my path I have 11.2 be careful with this. You can navigate and check that the path is correct for yours. 11.2 is the version we are installing. At the time of this post 11.2 was the latest one. Once you save the file we need to update the configuration by running:
sudo ldconfig
Now you should be ready to connect using:
sqlplus username/password@//dbhost:1521/SID
If you have problems with the SDK, you can check this
post.
Hope it helps someone and happy coding!