CentOS8下安装oracle客户端完整(填坑)过程分享(推
荐)
oracle32位客户端安装
⾸先uname -a
Linux localhost.localdomain 4.18.0-80.el8.x86_64 #1 SMP Tue Jun 4
09:19:46 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)
可以看到我的电脑是64位,系统版本是CentOS8,然⽽服务器oracle数据库是32位的,所以我⾸先想到安装32位的oracle客户端
进⼊
oracle-instantclient19.5-basic-19.5.0.0.0-1.i386.rpm
oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.i386.rpm
oracle-instantclient19.5-devel-19.5.0.0.0-1.i386.rpm(听别⼈说这个包也可以不下,我懒,不试)
rpm格式包详解
oracle-instantclient19.5-basic-19.5.0.0.0-1.i386.rpm
–基础包,为了运⾏OCI、OCCI、JDBC-OCI 这⼏个应⽤程序;
oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.i386.rpm
–补充包/⽂件,是为了运⾏sql*plus的即时客户端;
oracle-instantclient19.5-devel-19.5.0.0.0-1.i386.rpm
–包含头⽂件和⽰例⽂件,为开发Oracle应⽤程序的即时客户端;
oracle-instantclient19.5-odbc-19.5.0.0.0-1.i386.rpm
–补充包/⽂件,为运⾏ODBC环境附加库;
oracle-instantclient19.5-jdbc-19.5.0.0.0-1.i386.rpm
–补充JDBC下的XA、国际标准、⾏集操作;
依次安装
rpm -ivh oracle-instantclient19.5-basic-19.5.0.0.0-1.i386.rpm
rpm -ivh oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.i386.rpm
rpm -ivh oracle-instantclient19.5-devel-19.5.0.0.0-1.i386.rpm
安装的⽂件默认放在两个位置:
头⽂件:/usr/include/oracle/19.5/client/ 下,如果在使⽤时报错不到头⽂件,记得看路径是否是这个。
包⽂件:/usr/lib/oracle/19.5/client/ 下,包含{bin、lib}两个⽂件夹;
创建监听⽂件,并添加内容
vim /usr/lib/oracle/19.5/client/lib/network/a
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = *IP*)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = *SID*)
)
)
配置环境变量 vim /etc/profile,添加
#oracle19.5
export ORACLE_BASE=/usr/lib/oracle/19.5
export ORACLE_VERSION=19.5
export ORACLE_HOME=/usr/lib/oracle/$ORACLE_VERSION/client
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export SQLPATH=$ORACLE_HOME/lib/network/admin
export TNS_ADMIN=$ORACLE_HOME/lib/network/admin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
#export NLS_LANG="Simplified Chinese_china".ZHS16GBK
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
配置保存后
source /etc/profile
即可使配置即时⽣效
之后连接数据库测试
sqlplus /nolog
尴尬,提⽰:
bash: /bin/sqlplus: 沒有此⼀檔案或⽬錄
排查原因,这位⽼哥让我死⼼了:
⽼⽼实实卸载重装64位嗷T_T
oracle11g 创建数据库oracle64位客户端安装
先看看安装了哪些
rpm -qa | grep oracle
发现3个待宰羔⽺
oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.i386
oracle-instantclient19.5-basic-19.5.0.0.0-1.i386
oracle-instantclient19.5-devel-19.5.0.0.0-1.i386
考虑到三者之间可能会有依赖关系,rpm -e不够强⼒,所以直接加上–nodeps,简单粗暴rpm -e --nodeps oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.i386
rpm -e --nodeps oracle-instantclient19.5-basic-19.5.0.0.0-1.i386
rpm -e --nodeps oracle-instantclient19.5-devel-19.5.0.0.0-1.i386
然后⽼套路,下载64位包:
oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm
oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.x86_64.rpm
oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm
安装
rpm -ivh oracle-instantclient19.5-basic-19.5.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient19.5-sqlplus-19.5.0.0.0-1.x86_64.rpm
rpm -ivh oracle-instantclient19.5-devel-19.5.0.0.0-1.x86_64.rpm
创建监听⽂件,并添加内容,这边19.5后⾯的client多了个64~
vim /usr/lib/oracle/19.5/client64/lib/network/a加⼊
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = *IP*)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = *SID*)
)
这⾥我是要连公司的oracle服务器,所以是直接复制服务器下的a⽂件来⽤就可以了配置环境变量 vim /etc/profile,添加
#oracle19.5
export ORACLE_BASE=/usr/lib/oracle/19.5
export ORACLE_VERSION=19.5
export ORACLE_HOME=/usr/lib/oracle/$ORACLE_VERSION/client64
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export SQLPATH=$ORACLE_HOME/lib/network/admin
export TNS_ADMIN=$ORACLE_HOME/lib/network/admin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
#export NLS_LANG="Simplified Chinese_china".ZHS16GBK
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
配置保存后
source /etc/profile
即可使配置即时⽣效
之后连接数据库测试
sqlplus /nolog
sqlplus: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory
咋⼜报错了,我容易吗我,555~
可以看到,这个错误的关键字是libnsl.so.1,biying⼀下~
原来是缺少库⽂件
这⾥安装库包
dnf install libnsl
再输⼊
sqlplus /nolog
SQL*Plus: Release 19.0.0.0.0 - Production on Sat Dec 28 14:21:33 2019
Version 19.5.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
SQL>
到这⾥证明已经安装成功,远程连接可⽤如下形式:
sqlplus scott/123456:192.168.111.111:1521/orcl
按理来说⽬前我是可以连接oracle数据库了,但是,没有那么简单。。。。输⼊连接命令后提⽰:ERROR:
ORA-12170: TNS:Connect timeout occurred
照例,biying⼀下~
这位⽼哥说的不错,
果然,ping不通服务器。
下⾯就是联系⽹管打⼀顿了
~-------------------------------------
ping通⽹络后,连接如下
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
原来我们公司服务器oracle也是64位T-T。。。。
以上所述是⼩编给⼤家介绍的CentOS8下安装oracle客户端完整(填坑)过程分享,希望对⼤家有所帮助!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论