Monday, November 26, 2012

Oracle Instant Client & How to Install it ?

Install client allows you to run your application without installing oracle client or having an ORACLE_HOME.
It is easy to install client software for connecting to Oracle databases.It's available on all the platforms

Main purpose behind Oracle Instant Client : no need of oracle client installation on your machine for accessing the oracle server.It is alternative of oracle client installation with very less space .

It Consist of following packages :
  1. Basic : It provide the core functionality for all OCI,OCCI,and JDBC OCI applications.(around 97 MB)
  2. Basic Lite : Smaller version of the Basic  with only English error messages and code. Smaller size also.
  3. JDBC supplements :Additional support for XA, Internationalization, and RowSet operations under JDBC
  4. SQL*PLUS
  5. ODBC supplements
  6. SDK
By Contrast , the full oracle client installation consume about 700 MB space where as this Instant Client 97MB

Features :
    • take less space 
    • SQL*PLUS can be used with Instant Client.
    • No Reliance on typical Oracle CD installation'
    • Ease of deployment
    • same functionality as we have with Oracle client.
    • same high performance as we have with Oracle Client
    • No cost

From where we get this ?
Directly from the oracle site.
Download from the following locations as per your platform need :
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

How to install it ?
Here i am going to show you how to install Instant Client and SQL*PLUS on Fedora 15.

Package i have used :

Steps: 
  1. Download the required files as i have mentioned above based on your platform.
  2. Login as super user
  3. Run the rpm packages as follow 
    1. Go the directory where package was downloaded.
    2. Change the mode of the rpm file
      • chmod +x oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
    3. Execute the rpm file
      •  rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
Follow the same step for oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm.
This process create a oracle folder with necessary files in /usr/lib directory i.e /usr/lib/oracle.

Next step :
How to set ORACLE_HOME & LD_LIBRARY_PATH ? see here for more details.
Set the following configuration :

  export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
  export TNS_ADMIN=/usr/lib/oracle/11.2/client64
  export ORACLE_HOME=/usr/lib/oracle/11.2/client64
  export PATH=$PATH:/usr/lib/oracle/11.2/client64/bin

Finally your Oracle Instant Client is ready . Try sqlplus command.

How to connect to Oracle Server ?

  1. mkdir -p $ORACLE_HOME/network/admin
  2. cd [ directory containing tnsname.ora & sqlnet.ora]
  3. cp tnsname.ora sqlnet.ora $ORACLE_HOME/network/admin

For example your tnsname.ora contain :
latte=(DESCRIPTION = (ADDRESS =
                      (PROTOCOL = TCP)
                      (HOST = localhost)
                      (PORT = 1521))
                    (CONNECT_DATA =
                      (SERVICE_NAME = latte)
                      (SERVER = DEDICATED)))

Use this command for connecting to latte Oracle Server :
sqlplus username/password@latte.



Troubleshooting 
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

if you get this error, please make sure that there should not be / as the end while declaring ORACLE_HOME.


if you find this information useful, please comment.

No comments:

Post a Comment