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客户端

上一篇:[转]c 语言中 %d,%lu等区别


下一篇:不安装oracle客户端,用plsql连接oracle