標籤:oracle client 安裝配置
vi /home/oracle/.bashrc
umask 022
ORACLE_BASE=/usr/lib/oracle
ORACLE_HOME=$ORACLE_BASE/11.2/client64
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
TNS_ADMIN=/usr/lib/oracle/11.2/client/network/admin
Export LD_LIBRARY_PATH ORACLE_BASE ORACLE_HOME PATH TNS_ADMIN
注意 LD_LIBRARY_PATH必須添加 否則會找不到libsqlplus.so
下載oracle 11g sqlplus軟體
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.2.0.x86_64.rpm
安裝rpm包
rpm -ivh oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm
rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm
rpm -ivh oracle-instantclient11.2-devel-11.2.0.2.0.x86_64.rpm
指定sqlplus運行所需要的庫
由於是RPM包安裝的,因此,oracle用戶端預設所在的路徑為/usr/lib/oracle/11.2/client64/lib/
#vi /etc/ld.so.conf
在最後加入:/usr/lib/oracle/11.2/client64/lib
重啟ldconfig
ldconfig
使用root使用者登入,在/usr/lib/oracle/11.2/client64目錄下建立network/admin目錄,在此目錄下添加tnsnames.ora檔案。並且配置tnsnames.ora檔案(保持與DBA建立oracle庫一致)
LISTENER_TMSDB =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.14.102)(PORT = 1530))
TMSDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.14.102)(PORT = 1530))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = tmsdb.99bill.com)
)
)
通過jdbc
jdbc.driver=oracle.jdbc.driver.OracleDriver
#jdbc.url=jdbc:oracle:thin:@oracleIP:1530:tmsdb
jdbc.url=jdbc:oracle:thin:@//oracleIP:1530/tmsdb.99bill.com (兩種串連資料庫的方法一個通過tns 一個是通過資料庫名稱)
jdbc.username=nlcmp
jdbc.password=nlcmp980
hibernate.dialect=org.hibernate.dialect.OracleDialect
本文出自 “DavideyLee” 部落格,請務必保留此出處http://davideylee.blog.51cto.com/8703117/1533230