---
title: "Oracle Instant Client"
author: "hhhk"
date: "2012-10-30T15:38:40Z"
tags: []
categories: ["数据库"]
slug: "oracle-instant-client"
draft: false
lastmod: "2012-10-30T15:38:40Z"
id: 1708940
url: "https://hhhk.iteye.com/blog/1708940"
---

转自：[https://help.ubuntu.com/community/Oracle%20Instant%20Client](https://help.ubuntu.com/community/Oracle%20Instant%20Client)

# [Oracle Instant Client](https://help.ubuntu.com/community/Oracle%20Instant%20Client?action=fullsearch&value=linkto%3A%22Oracle%20Instant%20Client%22&context=180 "点击对这个标题进行全文检索")

* * *

 

# Introduction

 

目录

1. [Introduction](https://help.ubuntu.com/community/Oracle%20Instant%20Client#Introduction)
2. [Install RPMs](https://help.ubuntu.com/community/Oracle%20Instant%20Client#Install_RPMs)
3. [Integrate Oracle Libraries](https://help.ubuntu.com/community/Oracle%20Instant%20Client#Integrate_Oracle_Libraries)
4. [ORACLE\_HOME](https://help.ubuntu.com/community/Oracle%20Instant%20Client#ORACLE_HOME)
5. [SDK fix](https://help.ubuntu.com/community/Oracle%20Instant%20Client#SDK_fix)

Oracle Instant Client is a free [Oracle](https://help.ubuntu.com/community/Oracle) database client. The current version is 11.2.0.1.0, and several versions back to 10.1.0.5 are available.

 

# Install RPMs

- Download the Oracle Instantclient RPM files from[http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html](http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html). Everyone needs either "Basic" or "Basic lite", and most users will want "SQL\*Plus" and the "SDK".
- Convert these .rpm files into .deb packages and install using "[alien](https://help.ubuntu.com/community/alien)" ("sudo apt-get install alien" if you don't have it):
  
  ```
  alien -i oracle-instantclient-basic*.rpm
  alien -i oracle-instantclient-sqlplus*.rpm
  alien -i oracle-instantclient-devel*.rpm
  ```
- Test your Instantclient install by using "sqlplus" to connect to your database:

 

```
sqlplus  username/password@//dbhost:1521/SID
```

If sqlplus complains of a missing libaio.so.1 file, run 

```
sudo apt-get install libaio1
```

If sqlplus complains of a missing libsqlplus.so file, follow the steps in the section "Integrate Oracle Libraries" below.

If you execute sqlplus and get "sqlplus: command not found", see the section below about adding the ORACLE\_HOME variable. 

 

# Integrate Oracle Libraries

If oracle applications, such as sqlplus, are complaining about missing libraries, you can add the Oracle libraries to the LD\_LIBRARY\_PATH each time it is used, or to add it to the system library list create a new file as follows:

```
sudo vi /etc/ld.so.conf.d/oracle.conf
```

- and add the oracle library path as the first line. For example,

 

```
/usr/lib/oracle/11.1.0.1/client/lib
```

- or

 

```
/usr/lib/oracle/11.2/client/lib/
```

- Then run ldconfig:
  
  ```
  sudo ldconfig
  ```

 

# ORACLE\_HOME

Many Oracle database applications look for Oracle software in the location specified in the environment variable 'ORACLE\_HOME'.

Typical workstations will only have one Oracle install, and will want to define this variable in a system-wide location.

 

```
sudo vi /etc/profile.d/oracle.sh
```

Add the following:

```
export ORACLE_HOME=/usr/lib/oracle/11.1.0.1/client
```

or

```
export ORACLE_HOME=/usr/lib/oracle/11.2/client
```

Alternatively, each user can define this in their ~/.bash\_profile

Note: For 11.04 sqlplus was not recognized as a command unless the following line was also included in the oracle.sh file:

```
export PATH=$PATH:$ORACLE_HOME/bin
```

 

# SDK fix

Some packages may look for 'oci.h' in $ORACLE\_HOME/include, or in $ORACLE\_HOME/rdbms/public

The instant client sometimes places the include files, such as oci.h, in /usr/include/oracle/&lt;version&gt;/client.

Inspect your system by running the following commands

```
ls $ORACLE_HOME
ls -d /usr/include/oracle/*/client
```

If there is no 'include' directory under ORACLE\_HOME, and it is located over in /usr/include/oracle/ , create a symbolic link to assist packages looking for these header files. For example,

 

```
sudo ln -s /usr/include/oracle/11.2/client $ORACLE_HOME/include
```

And then check it is correct

```
ls $ORACLE_HOME
```