共计 2473 个字符,预计需要花费 7 分钟才能阅读完成。
在 Ubuntu 桌面上有很多图形化工具连接 Oracle 数据库, 比如 DBeaver 等,但有时还是需要通过 sqlplus 连接远程数据库,这时需要安装 Oracle 客户端了。本文介绍 Ubuntu 下安装 Oracle 12.2.0.5 客户端的步骤。
– 下载
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
备注:根据需要下载相应版本的客户端。
– 下载以下 rpm 包
linuxidc@linuxidc:~/Downloads$ ll *.rpm
–rw–rw–r—1 linuxidc linuxidc 34M 8月 2609:40 oracle–instantclient–basic–10.2.0.5–1.x86_64.rpm
–rw–rw–r—1 linuxidc linuxidc 284K 8 月2609:58 oracle–instantclient–devel–10.2.0.5–1.x86_64.rpm
–rw–rw–r—1 linuxidc linuxidc 776K 8月2609:57 oracle–instantclient–sqlplus–10.2.0.5–1.x86_64.rpm
– 安装: alien
linuxidc@linuxidc:~/Downloads$ sudo alien –i *.rpm
dpkg —no–force–overwrite –i oracle–instantclient–basic_10.2.0.5–2_amd64.deb
Selecting previously unselected package oracle–instantclient–basic.
(正在读取数据库 … 系统当前共安装有 309521 个文件和目录。)
Preparing to unpack oracle–instantclient–basic_10.2.0.5–2_amd64.deb …
Unpacking oracle–instantclient–basic (10.2.0.5–2)…
正在设置 oracle–instantclient–basic (10.2.0.5–2)…
Processing triggers for libc–bin (2.19–0ubuntu6.1)…
dpkg —no–force–overwrite –i oracle–instantclient–devel_10.2.0.5–2_amd64.deb
Selecting previously unselected package oracle–instantclient–devel.
(正在读取数据库… 系统当前共安装有 309536 个文件和目录。)
Preparing to unpack oracle–instantclient–devel_10.2.0.5–2_amd64.deb …
Unpacking oracle–instantclient–devel (10.2.0.5–2)…
正在设置 oracle–instantclient–devel (10.2.0.5–2)…
dpkg —no–force–overwrite –i oracle–instantclient–sqlplus_10.2.0.5–2_amd64.deb
Selecting previously unselected package oracle–instantclient–sqlplus.
(正在读取数据库… 系统当前共安装有 309579 个文件和目录。)
Preparing to unpack oracle–instantclient–sqlplus_10.2.0.5–2_amd64.deb …
Unpacking oracle–instantclient–sqlplus (10.2.0.5–2)…
正在设置 oracle–instantclient–sqlplus (10.2.0.5–2)…
备注:安装完成。
– 运行 sqlplus
linuxidc@linuxidc:/usr/lib/oracle/10.2.0.5/client64/bin$ ./sqlplus
./sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file:No such file or directory
备注:是因为 lib 环境变量没加。
– 环境变量添加以下
linuxidc@linuxidc:~$ vim ~/.bashrc
# env
export ORACLE_HOME=/usr/lib/oracle/10.2.0.5/client64
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
– 再次测试
linuxidc@linuxidc:~$ source .bashrc
linuxidc@linuxidc:~$ which sqlplus
/usr/lib/oracle/10.2.0.5/client64/bin/sqlplus
sqlplus username/password@//dbhost:1521/SID
备注:这时测试 sqlplus 连接远程 oracle 数据库成功,文档中提到如果此步出现缺少 libaio.so.1 文件的错误,则需要运行“sudo apt-get install libaio1”命令。
更多 Oracle 相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
更多 Ubuntu 相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2
本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-04/130447tm