CentOS7 安裝oracle客戶端


1、本機環境CentOS7 64  

[root@localhost etc]# uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost etc]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core) 

2、下載oracle客戶端包

  進入主頁面:http://www.oracle.com/technetwork/topics/linuxsoft-082809.html

  下載當前的最新版本18.03,只下載下面兩個文件即可

  oracle-instantclient18.3-basic-18.3.0.0.0-1.i386.rpm
  oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.i386.rpm

3、rpm方式安裝包

  將上述下載文件放到centos中某個目錄下,我的放在/home/ftpuser/下

[root@localhost ftpuser]# pwd
/home/ftpuser
[root@localhost ftpuser]# ls -l
總用量 54076
-rw-r--r--. 1 ftpuser ftpuser 54650380 1月   3 10:09 oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
-rw-r--r--. 1 ftpuser ftpuser   717272 1月   3 10:09 oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.x86_64.rpm
進入目錄,使用命令安裝:
  rpm -ivh oracle-instantclient18.3-basic-18.3.0.0.0-1.i386.rpm
  rpm -ivh  oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.i386.rpm
rpm簡單命令復習
  1.安裝軟件:執行rpm -ivh rpm包名 
  2.查詢軟件包的詳細信息:執行rpm -qpi rpm包名

4、環境變量配置

  打開用戶專屬配置文件(個人理解相當於windows系統環境變量的用戶變量,只針對當前用戶生效):vi ~/.bash_profile

  在最后增加如下幾行(注意路徑是否正確):  

[root@localhost ~]# vi ~/.bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export ORACLE_VERSION=18.3
export ORACLE_HOME=/usr/lib/oracle/$ORACLE_VERSION/client64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
#export NLS_LANG="Simplified Chinese_china".ZHS16GBK
export PATH=$PATH:$ORACLE_HOME/bin

  按下esc輸入 :wq 保存退出,執行:source ~/.bash_profile 命令,以便以后重啟后生效

5、配置TNS

  復制oracle服務端的tnsnames.ora文件,放到/usr/lib/oracle/18.3/client64/network/admin目錄下。

6、測試

[root@localhost 18.3]# sqlplus test/ok123@PRODUCT_DB

SQL*Plus: Release 18.0.0.0.0 - Production on Mon Apr 8 16:33:32 2019
Version 18.3.0.0.0

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

Last Successful login time: Mon Apr 08 2019 13:33:20 +08:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

 

7、參考資料 

1、在centos中安裝oracle客戶端並配置環境變量

2、centos7下部署oracle客戶端

3、CentOS linux下安裝Oracle客戶端

4、在Centos 5.6下面利用instant 安裝oracle客戶端

 


免責聲明!

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



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