Installing oracle instant client on Linux

This is a miniguide to install sqlplus with the minimal oracle-software fingerprint. As far as I can, I avoid to install the Oracle Client in my computers, because in MS Windows it modifies heavily the registry, and in linux you should set a lot of environment variables and deal with Oracle Universal Installer (OUI) that depends on many packages, versions, java … etc. And there is a better solution to install a simple sqlplus without installing the whole Oracle Client: oracle instant client.

I’ve used the version, but I suppose that using any other 10.X or even 11.X version should be similar.

  1. Download instantclientXX files for your *NIX platform from oracle site. You only need the oracle-instantclient-basic and sqlplus packages, in Zip format (about 35Mb total). Move them to tmp and unzip.
  2. Create the following directory structure and spread the files over as:
    root@core:/opt/oracle# tree
    |– bin
    |   |– genezi
    |   |– glogin.sql
    |   |– sqlnet.log
    |   `– sqlplus
    |– doc
    |   |– BASIC_README
    `– lib
    |– classes12.jar
    `– ojdbc14.jar
  3. Create the subdirectory network and create a tnsnames.ora sample file
    root@core:/opt/oracle# mkdir network
    root@core:/opt/oracle# cat tnsnames.ora
    (ADDRESS = (PROTOCOL = TCP) (HOST = = 1521))
  4. Add the SO files path to the In debian-based *NIXes that consist in creating a file under /etc/ that contains the new path for SO files. In redhat-based *NIXes you should add the /opt/oracle/lib to the contents of /etc/ file.
    root@core:/opt/oracle# vi /etc/
  5. Run ldconfig tocreate the necessary links and cache for use by the runtime linker.
    root@core:/opt/oracle# ldconfig
  6. Finally, add /opt/oracle/bin to the user’s PATH, and declare TNS_ADMIN envvar pointing to the location of tnsnames.ora file, like:
    root@core:/opt/oracle# export TNS_ADMIN=/opt/oracle/network
    Or add the following line to the /etc/profile
    export TNS_ADMIN=~/oracle
    In order to allow each user to create its own tnsnames.ora file under his home.
  7. And enjoy:
    root@core:/opt/oracle/bin# sqlplus /nolog
    SQL*Plus: Release - Production on Sun Jul 19 12:31:00 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    SQL> conn system/manager@XE

One Response to “Installing oracle instant client on Linux”

  1. Awesome post, thank you! This really saved me a lot of time. I’d like to add that I needed to point some env variables for this to work. I just added the following to the end of my process and it works like a charm!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: