在 ubuntu 桌面上有很多图形化工具连接 oracle 数据库, 比如 DBeaver 等, 但有时还是需要通过 sqlplus 连接远程数据库,这时需要安装 oracle 客户端了。本文介绍 ubuntu 下安装 oracle 12.2.0.5 客户端的步骤。 --下载 http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html 备注:根据需要下载相应版本的客户端。--下载以下 rpm 包 francs@francs:~/Downloads$ ll *.rpm -rw-rw-r-- 1 francs francs 34M 8月 26 09:40 oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm -rw-rw-r-- 1 francs francs 284K 8月 26 09:58 oracle-instantclient-devel-10.2.0.5-1.x86_64.rpm -rw-rw-r-- 1 francs francs 776K 8月 26 09:57 oracle-instantclient-sqlplus-10.2.0.5-1.x86_64.rpm --安装: alienfrancs@francs:~/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 francs@francs:/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 环境变量没加。--环境变量添加以下 francs@francs:~$ 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 --再次测试francs@francs:~$ source .bashrc francs@francs:~$ 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” 命令。 --参考
|