Linux安裝oracle客戶端


oracle客戶端下載地址: https://www.oracle.com/database/technologies/instant-client/downloads.html.

Instant Client Installation for Linux x86-64 (64-bit)

Installation of ZIP files:

Download the desired Instant Client ZIP files. All installations require a Basic or Basic Light package.

Unzip the packages into a single directory such as /opt/oracle/instantclient_19_3 that is accessible to your application. For example:

cd /opt/oracle     

unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip

cd /opt/oracle    

unzip instantclient-basic-linux.x64-19.3.0.0.0dbru.zip

The various packages install into subdirectories of /usr/lib/oracle, /usr/include/oracle, and /usr/share/oracle.

Prior to version 18.3, create the appropriate links for the version of Instant Client. For example:

cd /opt/oracle/instantclient_12_2
ln -s libclntsh.so.12.1 libclntsh.so
ln -s libocci.so.12.1 libocci.so
cd /opt/oracle/instantclient_12_2
ln -s libclntsh.so.12.1 libclntsh.so
ln -s libocci.so.12.1 libocci.so

Install the operating system libaio package. This is called libaio1 on some Linux distributions. On Oracle Linux 8 prior to Instant Client 21 you also need the libnsl package.
For example, on Oracle Linux, run:

sudo yum install libaio

If Instant Client is the only Oracle Software installed on this system then update the runtime link path, for example:

sudo sh -c "echo /opt/oracle/instantclient_19_3 > \
      /etc/ld.so.conf.d/oracle-instantclient.conf"
  sudo ldconfig
sudo sh -c "echo /opt/oracle/instantclient_19_3 > \
      /etc/ld.so.conf.d/oracle-instantclient.conf"
  sudo ldconfig

Alternatively, set the LD_LIBRARY_PATH environment variable prior to running applications. For example:

export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_3:$LD_LIBRARY_PATH

The variable can optionally be added to configuration files such as ~/.bash_profile and to application configuration files such as /etc/sysconfig/httpd.

If you intend to co-locate optional Oracle configuration files such as tnsnames.ora, sqlnet.ora, ldap.ora, or oraaccess.xml with Instant Client, put them in the network/admin subdirectory. This needs to be created for 12.2 and earlier, for example:

mkdir -p /opt/oracle/instantclient_12_2/network/admin

This is the default Oracle configuration directory for applications linked with this Instant Client.

Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable TNS_ADMIN to that directory name.

To use binaries such as sqlplus from the SQL*Plus package, unzip the package to the same directory as the Basic package and then update your PATH environment variable, for example:

export PATH=/opt/oracle/instantclient_19_3:$PATH

Start your application.

Installation of RPM files:

Download the desired Instant Client RPM packages. All installations require a Basic or Basic Light RPM.
Install the packages with yum. For example:

sudo yum install oracle-instantclient19.3-basic-19.3.0.0.0-1.x86_64.rpm

Note that from 19.3, by default only one version of the Instant Client RPM libraries can be installed at a time.

Prior to 19.3, if Instant Client is the only Oracle Software installed on this system then update the runtime link path, for example:

sudo sh -c "echo /usr/lib/oracle/18.3/client64/lib > \
      /etc/ld.so.conf.d/oracle-instantclient.conf"
  sudo ldconfig
sudo sh -c "echo /usr/lib/oracle/18.3/client64/lib > \
      /etc/ld.so.conf.d/oracle-instantclient.conf"
  sudo ldconfig

For Instant Client 19.3 RPM packages, these commands are automatically run.

An alternative to using ldconfig for older versions, is to set the LD_LIBRARY_PATH environment variable in each shell prior to running applications. For example:

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

The variable can optionally be added to configuration files such as ~/.bash_profile and to application configuration files such as /etc/sysconfig/httpd.

If you intend to co-locate optional Oracle configuration files such as tnsnames.ora, sqlnet.ora ldap.ora, or oraaccess.xml with Instant Client, put them in the network/admin subdirectory. This needs to be created for 12.2 and earlier, for example:

sudo mkdir -p /usr/lib/oracle/12.2/client64/lib/network/admin

This is the default Oracle configuration directory for applications linked with this Instant Client.

Alternatively, Oracle configuration files can be put in another, accessible directory. Then set the environment variable TNS_ADMIN to that directory name.

To use binaries from the tools package, use yum to install the package and then update your PATH environment variable, for example:

export PATH=/usr/lib/oracle/19.3/client64/bin:$PATH

Start your application.

參考:OracleClient install on Linux

Centos環境變量設置

利用profile.d文件夾管理環境變量

1.創建oracle.sh文件

export PATH=/usr/lib/oracle/12.2/client64/bin:$PATH
export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_LIBRARY_PATH

2.將oracle.sh文件上傳至 /etc/profile.d 文件夾中

3.加載環境變量

source /etc/profile

4.查詢環境變量

env |grep LD_LIBRARY_PATH
env |grep PATH

參考:Centos 配置JDK,添加環境變量/etc/profile和/etc/profile.d

ubuntu安裝oracle客戶端

需要將rpm包轉為deb包,具體安裝方法


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM