Ubuntu16.04下安裝oracle用戶端

來源:互聯網
上載者:User

標籤:

在Ubuntu16.04下安裝oracle資料庫用戶端,使Django項目串連到Oracle資料庫

1.下載oracle用戶端安裝包:

  進入官網http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html下載如下所需的三個包。

oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpmoracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpmoracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

2.使用alien安裝

  下載alien(alien可以把rpm格式轉為dev格式進行rpm包的安裝):

sudo apt-get install alien

  進行安裝

sudo alien -i oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpmsudo alien -i oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpmsudo alien -i oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

  安裝所需要的庫:

sudo apt-get install libaio1

3.配置環境

  ①開啟/etc/ld.so.conf檔案

sudo gedit  /etc/ld.so.conf

  新增內容: /usr/lib/oracle/11.2/client64/lib/
  執行/sbin/ldconfig命令,使其生效

  開啟/etc/profile檔案

sudo gedit /etc/profile

  ②添加如下環境變數

export ORACLE_HOME=/usr/lib/oracle/11.2/client64export ORACLE_BASE=/usr/lib/oracle/11.2export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/libexport PATH=$PATH:$ORACLE_HOME/bin

  執行命令source /etc/profile, 使其生效

4.Django串連oracle, 還需要庫cx_oracle.

  在Django項目所用的虛擬環境下,安裝cx_oracle

pip install cx_Oracle-5.2.1

至此,Django可以成功串連oracle資料庫。

  

Ubuntu16.04下安裝oracle用戶端

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.