Install Oracle Instant Client on Ubuntu (Linux)

To Access Oracle form the Ubuntu Linux as its open Source Platform, is easy and its installation process is also easy. As Oracle instant client is a free tool that is provided by Oracle Corporation and easily available on Oracle website. This client is are available for every Platform like Windows, Linux,Unix and all other platform. Latest Version of Oracle Instant client is 12.2 which is for all platform like windows, Linux x86-64 and all other platforms. you can download this on this http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

Every one need Basic Instant Client or Basic-Lite..

First you need to download these 3 packages that you can download from http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

  1. oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
  2. oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm
  3. oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm

These Packages that you can download from website keep these all RPM file in one folder and now open the command line of Ubuntu install alien package on Ubuntu. this package convert the .RPM file into .Deb file that are executable on Ubuntu Linux.

sudo apt-get install alien

after installing alien on Ubuntu now install the RPM package on Ubuntu using alien.

sudo alien -i oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm

sudo alien -i oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm

sudo alien -i oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm

after installing these packages now try to connect the oracle instant client with oracle with following string.

sqlplus username/password@//dbhost:1521/SID

While exeucting sqlplus if you got error that sqlplus: command not found then you need to add ORACLE_HOME variables. so first install libaio1

sudo apt-get install libaio1




sudo apt-get install libaio1:i386  —(32 bit instant client on 64 bit OS)

Oracle Libraries Integration

if sqlplus is complain about the missing libraries then you can add the libraries to the LD_LIBRARY_PATH using the following command.

export LD_LIBRARY_PATH=/usr/lib/oracle/<version>/client(64)/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

for Example if the version 12.2 and Linux x86-64 the you will execute the following command.

export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client(64)/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

now Execute the following command to add it to the system library list, create new file as follow

sudo vi /etc/ld.so.conf.d/oracle.conf && sudo chmod o+r /etc/ld.so.conf.d/oracle.conf    and add /usr/lib/oracle/12.2/client64/lib/   (for 64 bit OS)   /usr/lib/oracle/12.2/client/lib/   ( for 32 bit OS)

now run:-  sudo ldconfig

Setting ORACLE_HOME

Oracle database applications look for Oracle software in the location specified in the environment variable ‘ORACLE_HOME’.

 to define this variable in a system-wide location.

sudo sudo vi /etc/profile.d/oracle.sh && sudo chmod o+r /etc/profile.d/oracle.sh 

Add the following Line : –

export ORACLE_HOME=/usr/lib/oracle/<version>/client(64)

For example

export ORACLE_HOME=/usr/lib/oracle/12.2/client64

Alternatively, each user can define this in their ~/.bash_profile

 sqlplus was not recognized as a command untill the following line was also included in the oracle.sh file:

export PATH=$PATH:$ORACLE_HOME/bin

Fixing SDK

The instant client sometimes places the include files, such as oci.h, in /usr/include/oracle/<version>/client.

Run Following command to identify

ls $ORACLE_HOME
ls -d /usr/include/oracle/*/client*/*

if  ORACLE_HOME, and it is located over in /usr/include/oracle/ , create a symbolic link 

sudo ln -s /usr/include/oracle/12.2/client $ORACLE_HOME/include

or:

sudo ln -s /usr/include/oracle/12.2/client64 $ORACLE_HOME/include

And then check it is correct

ls $ORACLE_HOME

Now on Command line run the below command

sqlplus username/password@//dbhost:1521/SID

as you run this command your prompt will come on

sql>_

now you can run queries and run you oracle related tool..



Leave a Reply

Your email address will not be published. Required fields are marked *