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
oracle client 安装配置,布布扣,bubuko.com
原文地址:http://davideylee.blog.51cto.com/8703117/1533230