Install the Oracle Instant Client in Linux and Windows.

Source: Internet
Author: User

Oracle Database software is very large, and the database engine has several GB. Generally, we use Oracle to install an Oracle database on a server machine and operate data on the server on the client using tools such as PL/SQL developer and sqlplus. Of course, after Oracle 10 Gb, the OEM (Enterprise Manager) is already in the web version. You can also operate the database in the browser.

However, PL/SQL developer is the most commonly used client tool in windows. In Linux, I like to use sqlplus directly. Regardless of the tool used, you must install the Oracle client tool on the client machine. You can install the following three types of software to connect to the Oracle server:

(A) Oracle Database Engine (B) Oracle client (c) Oracle Instant Client

The first two methods occupy a large disk space and are relatively cumbersome to install. I generally prefer the third method. Therefore, the following describes how to install the Oracle Instant Client:

(1) install Oracle Instant Client in Windows

(I) download the Oracle Instant Client
Go to the Oracle official website home page (http://www.oracle.com), click the download (downloads) link in the home page, select database ---> Instant Client in the new page, enter the Instant Client Downloads page, select the corresponding Version Download.
Oracle Chinese website is http://www.oracle.com/cn/index.html

The software packages I downloaded are: basic and sqlplus.

Note: You must download either basic or basiclite. To develop OCI/occi, you must also download the SDK.

For example, what I downloaded is:

Instantclient-basic-win32-10.2.0.3-20061115.zip

Instantclient-sqlplus-win32-10.2.0.3-20061115.zip

(Ii) install Oracle Instant Client

Installation is very simple, just extract the two packages directly, extract the two packages to the same directory, for example, extract to the Directory D: \ instantclient-10.2.0.3-win32.

The last directory structure is: D: \ instantclient-10.2.0.3-win32 \ instantclient_10_2, instantclient_10_2 directory is the basic and sqlplus after decompression.

(Iii) Create a database connection file

Create the admin folder under the D: \ instantclient-10.2.0.3-win32 \ instantclient_10_2 directory, create the file tnsnames. ora under the Admin directory, enter the following similar content according to the database connection

# tnsnames.ora Network Configuration File: /opt/oracle_11g_R2_x64/product/11.2.0.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.232.133) (PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
     This file is similar to the file content in the database server, and its role is to configure the connection string when connecting in sqlplus and PL / SQL Developer. Everyone knows the purpose of this file, so I wo n’t go into details.

(iiii) Configure Windows environment variables

     ORACLE_HOME = D: \ instantclient-10.2.0.3-win32 \ instantclient_10_2

     Path =% ORACLE_HOME%; xxxxxx ===> The function is to find sqlplus and other commands on the command line, and load related libraries when running sqlplus

     TNS_ADMIN =% ORACLE_HOME% \ admin ===> The role is to find the connector in tnsnames.ora when connecting to the database in tools such as sqlplus

     NLS_lANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK ===> set the character set of the client

(iiiii) Finish, test!

    After the above steps, Oracle Instant Client is installed and you can use commands in the command line to connect to the server.

   C: \ Users \ zkl> sqlplus / nolog
     SQL * Plus: Release 10.2.0.3.0-Production on Tuesday January 10 10:52:53 2012
     Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
     SQL> conn scott / tiger @ orcl ===> Use ORCL in tnsnames.ora under% TNS_ADMIN%

(2) Installation of Oracle Instant Client under Linux

(i) Download

  There are two kinds of Oracle Instant Client under Linux: rpm package and zip package. You can download either one. Here is an example of the downloaded zip package. For the installation of the downloaded rpm package, see Oracle Instant Client rpm package installation

   oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.zip

   oracle-instantclient11.2-sqlplus-11.2.0.1.0-1.x86_64.zip

   oracle-instantclient11.2-sdk-11.2.0.1.0-1.x86_64.zip

(ii) Unzip and install

[root @ glnode04 linux-11.2.0.1.0-1.x86_64] # unzip oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.zip

[root @ glnode04 linux-11.2.0.1.0-1.x86_64] # unzip oracle-instantclient11.2-sdk-11.2.0.1.0-1.x86_64.zip

[root @ glnode04 linux-11.2.0.1.0-1.x86_64] # unzip oracle-instantclient11.2-sqlplus-11.2.0.1.0-1.x86_64.zip

The file is decompressed to the directory instantclient_11_2, and the directory contents are as follows:

[root @ glnode04 instantclient_11_2] # ls
adrci glogin.sql libocci.so.11.1 libsqlplusic.so ojdbc6.jar SQLPLUS_README

BASIC_README libclntsh.so.11.1 libociei.so libsqlplus.so sdk xstreams.jar
genezi libnnz11.so libocijdbc11.so ojdbc5.jar sqlplus

(iii) Create a database connection file

      Create the network / admin directory in the instantclient_11_2 directory, use the command mkdir network / admin, and create the tnsnames.ora file in the admin directory. The file content is similar to the following:

# tnsnames.ora Network Configuration File: /sdb1/oracle/11gR2_database_X64/product/11.2.0.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ZKL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = glnode04) (PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = zkl)
    )
  )
(iiii) Configure environment variables

     Configure the root user environment variable here: ~ / .bashrc

export ORACLE_HOME = / root / linux-11.2.0.1.0-1.x86_64 / instantclient_11_2
export PATH = $ ORACLE_HOME: $ PATH
export TNS_ADMIN = $ ORACLE_HOME / network / admin
export LD_LIBRARY_PATH = $ ORACLE_HOME: $ LD_LIBRARY_PATH
export NLS_LANG = 'simplified chinese_china.ZHS16GBK'
Note that if you want to configure the LD_LIBRARY_PATH variable, you need to load the corresponding library when running programs such as sqlplus. If you do not configure it, the following error will occur during runtime:

Error 6 initializing SQL * Plus
SP2-0667: Message file sp1 <lang> .msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

After configuration, source ~ / .bashrc

(iiiiii) Finish, test!

[root @ glnode04 instantclient_11_2] # sqlplus / nolog

SQL * Plus: Release 11.2.0.1.0 Production on Tuesday January 10 11:14:31 2012

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> conn zkl / zkl @ zkl
connected.
SQL># tnsnames.ora Network Configuration File: /opt/oracle_11g_R2_x64/product/11.2.0.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.232.133) (PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
     This file is similar to the file content in the database server, and its role is to configure the connection string when connecting in sqlplus and PL / SQL Developer. Everyone knows the purpose of this file, so I wo n’t go into details.

(iiii) Configure Windows environment variables

     ORACLE_HOME = D: \ instantclient-10.2.0.3-win32 \ instantclient_10_2

     Path =% ORACLE_HOME%; xxxxxx ===> The function is to find sqlplus and other commands on the command line, and load related libraries when running sqlplus

     TNS_ADMIN =% ORACLE_HOME% \ admin ===> The role is to find the connector in tnsnames.ora when connecting to the database in tools such as sqlplus

     NLS_lANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK ===> set the character set of the client

(iiiii) Finish, test!

    After the above steps, Oracle Instant Client is installed and you can use commands in the command line to connect to the server.

   C: \ Users \ zkl> sqlplus / nolog
     SQL * Plus: Release 10.2.0.3.0-Production on Tuesday January 10 10:52:53 2012
     Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
     SQL> conn scott / tiger @ orcl ===> Use ORCL in tnsnames.ora under% TNS_ADMIN%

(2) Installation of Oracle Instant Client under Linux

(i) Download

  There are two kinds of Oracle Instant Client under Linux: rpm package and zip package. You can download either one. Here is an example of the downloaded zip package. For the installation of the downloaded rpm package, see Oracle Instant Client rpm package installation

   oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.zip

   oracle-instantclient11.2-sqlplus-11.2.0.1.0-1.x86_64.zip

   oracle-instantclient11.2-sdk-11.2.0.1.0-1.x86_64.zip

(ii) Unzip and install

[root @ glnode04 linux-11.2.0.1.0-1.x86_64] # unzip oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.zip

[root @ glnode04 linux-11.2.0.1.0-1.x86_64] # unzip oracle-instantclient11.2-sdk-11.2.0.1.0-1.x86_64.zip

[root @ glnode04 linux-11.2.0.1.0-1.x86_64] # unzip oracle-instantclient11.2-sqlplus-11.2.0.1.0-1.x86_64.zip

The file is decompressed to the directory instantclient_11_2, and the directory contents are as follows:

[root @ glnode04 instantclient_11_2] # ls
adrci glogin.sql libocci.so.11.1 libsqlplusic.so ojdbc6.jar SQLPLUS_README

BASIC_README libclntsh.so.11.1 libociei.so libsqlplus.so sdk xstreams.jar
genezi libnnz11.so libocijdbc11.so ojdbc5.jar sqlplus

(iii) Create a database connection file

      Create the network / admin directory in the instantclient_11_2 directory, use the command mkdir network / admin, and create the tnsnames.ora file in the admin directory. The file content is similar to the following:

# tnsnames.ora Network Configuration File: /sdb1/oracle/11gR2_database_X64/product/11.2.0.1.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ZKL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP) (HOST = glnode04) (PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = zkl)
    )
  )
(iiii) Configure environment variables

     Configure the root user environment variable here: ~ / .bashrc

export ORACLE_HOME = / root / linux-11.2.0.1.0-1.x86_64 / instantclient_11_2
export PATH = $ ORACLE_HOME: $ PATH
export TNS_ADMIN = $ ORACLE_HOME / network / admin
export LD_LIBRARY_PATH = $ ORACLE_HOME: $ LD_LIBRARY_PATH
export NLS_LANG = 'simplified chinese_china.ZHS16GBK'
Note that if you want to configure the LD_LIBRARY_PATH variable, you need to load the corresponding library when running programs such as sqlplus. If you do not configure it, the following error will occur during runtime:

Error 6 initializing SQL * Plus
SP2-0667: Message file sp1 <lang> .msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

After configuration, source ~ / .bashrc

(iiiiii) Finish, test!

[root @ glnode04 instantclient_11_2] # sqlplus / nolog

SQL * Plus: Release 11.2.0.1.0 Production on Tuesday January 10 11:14:31 2012

Copyright (c) 1982, 2009, Oracle. All rights reserved.

SQL> conn zkl / zkl @ zkl
connected.
SQL>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.