Ubuntu 安裝 Oracle 用戶端

來源:互聯網
上載者:User

Ubuntu 安裝 Oracle 用戶端

在 Ubuntu 案頭上有很多圖形化工具串連 Oracle 資料庫,  比如 DBeaver 等, 但有時還是需要通過 sqlplus 串連遠端資料庫,這時需要安裝 Oracle 用戶端了。本文介紹 Ubuntu 下安裝 Oracle 12.2.0.5 用戶端的步驟。

--下載

http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

備忘:根據需要下載相應版本的用戶端。

--下載以下 rpm 包

bkjia@bkjia:~/Downloads$ ll *.rpm
-rw-rw-r--1 bkjia bkjia  34M  8月2609:40 oracle-instantclient-basic-10.2.0.5-1.x86_64.rpm
-rw-rw-r--1 bkjia bkjia 284K  8月2609:58 oracle-instantclient-devel-10.2.0.5-1.x86_64.rpm
-rw-rw-r--1 bkjia bkjia 776K  8月2609:57 oracle-instantclient-sqlplus-10.2.0.5-1.x86_64.rpm

--安裝: alien

bkjia@bkjia:~/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

bkjia@bkjia:/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 環境變數沒加。

--環境變數添加以下

bkjia@bkjia:~$ 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

--再次測試

bkjia@bkjia:~$ source .bashrc

bkjia@bkjia:~$ 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” 命令。

本文永久更新連結地址:http://www.bkjia.com/Linux/2016-04/130447tm

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.