ubuntu下安装oracle客户端

Install RPMs

alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
alien -i oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
alien -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
  • Test your Instantclient install by using "sqlplus" or "sqlplus64" 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:

export LD_LIBRARY_PATH=/usr/lib/oracle/<version>/client(64)/lib/:$LD_LIBRARY_PATH

For example, 12.1 version for Linux x86_64:

export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib/:$LD_LIBRARY_PATH

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/12.1/client64/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/<version>/client(64)

For example

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

Alternatively, each user can define this in their ~/.bash_profile

Note: From Ubuntu 11.04 (confirmed in 11.04 and 14.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/<version>/client.

Inspect your system by running the following commands

ls $ORACLE_HOMEls -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

or:

sudo ln -s /usr/include/oracle/12.1/client64 $ORACLE_HOME/include

And then check it is correct

ls $ORACLE_HOME

转载于:https://my.oschina.net/u/260715/blog/358367

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值