8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Misc » Here

Oracle Instant Client Installation

The Oracle Instant Client is a light-weight, freely distributable implementation of an Oracle client. A big advantage of the Instant Client is it does not need a formal installation. Instead, it can be unzipped and used without any fuss.

Related articles.

SQLcl

In many cases I now use SQLcl instead of the instant client. It's a small Java application from Oracle that gives you an SQL*Plus like experience, without needing a formal installation.

Before considering the instant client, you should ask yourself if SQLcl would be more appropriate.

Yum

Since September 2018 the instant client RPMs have been freely available on yum.oracle.com. If you are using Oracle Linux and have root access you can install the instant client using Yum with a few simple commands.

# (Optional) Get the latest repository info.
cd /etc/yum.repos.d
rm -f public-yum-ol7.repo
wget https://yum.oracle.com/public-yum-ol7.repo

# Enable the instant client repository.
yum install -y yum-utils
yum-config-manager --enable ol7_oracle_instantclient

# (Optional) Check what packages are available.
yum list oracle-instantclient*

# Install basic and sqlplus.
yum install -y oracle-instantclient18.3-basic oracle-instantclient18.3-sqlplus

After this installation you can use SQL*Plus as follows.

export CLIENT_HOME=/usr/lib/oracle/18.3/client64
export LD_LIBRARY_PATH=$CLIENT_HOME/lib
export PATH=$PATH:$CLIENT_HOME/bin

sqlplus /nolog

If you are running RHEL or another clone, you can download these RPMs from yum.oracle.com and install them locally.

Manual Installation

The manual installation approach has two significant advantages over the Yum approach.

Download

The links below provide the general downloads page and the Linux x86-64 specific downloads, which will be used in this article.

There are a number of downloads available, depending on which features you require. The Linux versions also come with an RPM option, but as this requires root privilege to install, it may not be considered so desirable. The basic download provides all the core functionality necessary to make basic connections from Java. In this case, I wanted to make SQL*Plus connections, so I downloaded the following zip files.

Installation

Installation couldn't really be simpler.

$ mkdir ~/software
$ cd ~/software
$ unzip /tmp/instantclient-basic-linux.x64-11.2.0.4.0.zip
$ unzip /tmp/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip 

Use It

When using the Instant Client, we need to make sure the LD_LIBRARY_PATH environment variable is set to point to the location where the software was unzipped. In this case, I also set the PATH environment variable.

$ export LD_LIBRARY_PATH=/home/tomcat/software/instantclient_11_2
$ export PATH=$PATH:$LD_LIBRARY_PATH

$ sqlplus scott/tiger@//myhost.example.com:1521/myservice

That's it!

TNS_ADMIN

You can make connections to databases using the EZ Connect URL.

CONN scott/tiger@//myhost.example.com:1521/myservice

If you would prefer to use a "tnsnames.ora" file, you can do that too. Just set the TNS_ADMIN environment variable to the directory holding the file and it will work as expected. For example, imagine I had a "tnsnames.ora" file in my home directory with the following contents.

myservice= 
(DESCRIPTION = 
  (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.example.com)(PORT = 1521))
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = myservice)
  )
)

I would do the following.

export TNS_ADMIN=${HOME}

sql scott/tiger@myservice

For more information see:

Hope this helps. Regards Tim...

Back to the Top.