本文介紹在Ubuntu14.04系統(X64)上安裝Oracle Instant Client,安裝版本爲11.2.0.4.0(讀者須要按照本身安裝版本修改相應的版本號)html
在Oracle官網地址 http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html 下載如下RPM文件:linux
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
使用alien轉換PRM文件到DEB文件並安裝(sudo apt-get install alien
)sql
安裝alien後,執行下面的命令安裝Oracle客戶端:bash
sudo alien -i oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm sudo alien -i oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm sudo alien -i oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm sudo apt-get install libaio1
安裝如下步驟新增tnsnames.ora文件:服務器
cd /usr/lib/oracle/11.2/client64 sudo mkdir -p network/admin sudo vi tnsnames.ora
填寫以下內容,或者直接從oracle服務器端將相同目錄下的這個文件拷貝過來。oracle
# tnsnames.ora Network Configuration File XEDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.103)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) )
連接Oracle的庫文件到Oracle目錄:code
sudo ln -s /usr/include/oracle/11.2/client64 /usr/lib/oracle/11.2/client64/include
在登陸用戶的profile中增長如下內容:htm
export ORACLE_HOME=/usr/lib/oracle/11.2/client64 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib export TNS_ADMIN=$ORACLE_HOME/network/admin export PATH=$PATH:$ORACLE_HOME/bin export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"