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 10.2.0.4 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
    |   `– SQLPLUS_README
    `– lib
    |– classes12.jar
    |– libclntsh.so.10.1
    |– libnnz10.so
    |– libocci.so.10.1
    |– libociei.so
    |– libocijdbc10.so
    |– libsqlplus.so
    |– libsqlplusic.so
    `– 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
    IDENTIFIER =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP) (HOST = my.oracle.server.org)(PORT = 1521))
    )
    (CONNECT_DATA = (SID = ORCL))
    )
  4. Add the SO files path to the ld.so.conf. In debian-based *NIXes that consist in creating a file under /etc/ld.so.conf.d/ that contains the new path for SO files. In redhat-based *NIXes you should add the /opt/oracle/lib to the contents of /etc/ld.so.conf file.
    root@core:/opt/oracle# vi /etc/ld.so.conf.d/oracle.conf
    /opt/oracle/lib
    :wq!
  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 10.2.0.4.0 - Production on Sun Jul 19 12:31:00 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    SQL> conn system/manager@XE
    Connected.
    SQL>

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!

    TNS_ADMIN=/opt/oracle/network
    LD_LIBRARY_PATH=/opt/oracle/lib
    ORACLE_HOME=/opt/oracle
    PATH=$PATH:$ORACLE_HOME/bin
    export TNS_ADMIN ORACLE_HOME LD_LIBRARY_PATH PATH

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: