Thursday, March 24, 2016

Install Oracle Instant Client on Windows and linux

Oracle Instant Client enables you to access remote Oracle database as if it is local. Oracle Instant Client is an open source software.

Windows

A. Install Oralce Instant Client


1. Download Oracle Instant Client from its official website. Choose the version according to your           Oracle database and 64 or 32 bit according to your windows.

2. Extract the files in the downloaded zip file into a folder (e.g. C:\Program Files (x86)\Oracle Instant     Client\instantclient_11_1).

3. Add the Oracle Instant Client folder (C:\Program Files (x86)\Oracle Instant                                           Client\instantclient_11_1) to the PATH environmental variable.

    Create TNS_ADMIN and ORACLE_HOME environmental variables and set their values to the         Oracle Instant Client folder (C:\Program Files (x86)\Oracle Instant Client\instantclient_11_1).

    Restart your computer.

4. In the Oracle Instant Client folder (C:\Program Files (x86)\Oracle Instant Client\instantclient_11_1
    ), create the tnsnames.ora and sqlnet.ora files. Below are examples of the files.

      tnsnames.ora:
             It is usually located in your oracle database home/network/admin directory. You can copy from there. It looks like this.

             <Oracle database name> =
                   (DESCRIPTION =
                         (ADDRESS = (PROTOCOL = TCP)(HOST = <Oracle hose IP address>)(PORT = <Oracle database port>))
                         (CONNECT_DATA =
                               (SERVER = DEDICATED)
                                (SERVICE_NAME = <service name>)
                     )
                )

      sqlnet.ora:
            It tells Oracle to time out if a connection to Oracle server cannot be obtained within the specified time in seconds.

            TCP.CONNECT_TIMEOUT=10

B. Create the registry keys


1. Create the ORACLE Key

      Windows 64bit: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE
      Windows 32bit: HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE

2. Create a sub key in the above key using the folder of your Oracle Instant Client. For example.

      KEY_instantclient_11_1

3. Create the following string values in the above key.

      ORACLE_HOME, set value to the same as your ORACLE_HOME environmental variable.
      ORACLE_HOME_NAME, choose a name for it.
      NLS_LANG, pick a value from this website according to your language. For example.
            AMERICAN_AMERICA.WE8MSWIN1252

You are done.

Linux

A. Install Oracle Instant Client

Login as administrator.

1. Use command (uname -m) to decide the bit of your linux machine; and command (lsb_release -a or cat /etc/redhat-release ) to find the Distributor ID and release of your linux machine.

2. Create a dirctory /usr/oracle

3. Download the basic, sqlplus, and sdk packages of the oracle instant client from their  Official Website according to your machine. For example, if your linux is 64 bit, download the following packages.

      instantclient-basic-linux.x64-12.1.0.2.0.zip
      instantclient-sqlplus-linux.x64-12.1.0.2.0.zip
      instantclient-sdk-linux.x64-12.1.0.2.0.zip

4. Run the command below.

      unzip /usr/oracle/instantclient-basic-linux.x64-12.1.0.2.0.zip
      unzip /usr/oracle/instantclient-sqlplus-linux.x64-12.1.0.2.0.zip
      unzip /usr/oracle/instantclient-sdk-linux.x64-12.1.0.2.0.zip

Create the appropriate libclntsh.so and libocci.so links for the version of Instant Client.
     ln -s /usr/oracle/instantclient_12_1/libclntsh.so.12.1 /usr/oracle/instantclient_12_1/libclntsh.so
     ln -s /usr/oracle/instantclient_12_1/libocci.so.12.1 /usr/oracle/instantclient_12_1/libocci.so
      
      ln -s /usr/oracle/instantclient_12_1/libclntshcore.so.12.1 /usr/lib/libclntshcore.so.12.1
      ln -s /usr/oracle/instantclient_12_1/libipc1.so /usr/lib/libipc1.so   
      ln -s /usr/oracle/instantclient_12_1/libmql1.so /usr/lib/libmql1.so
      ln -s /usr/oracle/instantclient_12_1/libnnz12.so /usr/lib/libnnz12.so
      ln -s /usr/oracle/instantclient_12_1/libocci.so /usr/lib/libocci.so
      ln -s /usr/oracle/instantclient_12_1/libociei.so /usr/lib/libociei.so
      ln -s /usr/oracle/instantclient_12_1/libocijdbc12.so /usr/lib/libocijdbc12.so
      ln -s /usr/oracle/instantclient_12_1/libons.so /usr/lib/libons.so
      ln -s /usr/oracle/instantclient_12_1/liboramysql12.so /usr/lib/liboramysql12.so 
      ln -s /usr/oracle/instantclient_12_1/libsqlplus.so /usr/lib/libsqlplus.so
      ln -s /usr/oracle/instantclient_12_1/libsqlplusic.so /usr/lib/libsqlplusic.so
      ln -s /usr/oracle/instantclient_12_1/libclntsh.so /usr/lib/libclntsh.so

5. Set the LD_LIBRARY_PATH and environmental variables
     Modify the /root/.bash_profile file. Add :/usr/oracle/instantclient_12_1 to the end of the PATH. And add the following lines.

      export LD_LIBRARY_PATH=/usr/oracle/instantclient_12_1
      export ORACLE_HOME=/usr/oracle/instantclient_12_1
      export TNS_ADMIN=/usr/oracle/instantclient_12_1

If any of the above environmental variables already exists, append the path preceded by a colon to the end of the existing path

6. Test the Oracle Instant Client.

      sqlplus <oracle user>/<oracle password>@//<oracle IP address>:<port>/<Oracle database name>
      (e.g. sqlplus SCOTT/TIGER@//11.15.0.112:1521/ORACLE)

-----------------------------------------------------------------------------------------------------------
                        

If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

      

No comments:

Post a Comment