linux安装oracle客户端

首先Oracle官网下载安装包:
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

安装解压缩到/usr/local/oracle
mkdir /usr/local/oracle
unzip /usr/local/oracle/instantclient-basic-linux.x64-11.2.0.4.0.zip 
unzip /usr/local/oracle/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip
cd /usr/local/oracle/instantclient_11_2 
mkdir -p network/admin
cd network/admin
新建tnsnames.ora文件

CM =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.11)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = cm)
    )
  )
 

添加环境变量
vi .bash_profile

export ORACLE_HOME=/usr/local/oracle/instantclient_11_2
export TNS_ADMIN=$ORACLE_HOME/network/admin
##export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=$ORACLE_HOME
export PATH=$ORACLE_HOME:$PATH

执行环境变量
source .bash_profile

测试数据库连接
sqlplus username/passwd@cm

本文参考
https://blog.csdn.net/andy_wcl/article/details/79470705

  

posted @ 2019-09-03 16:22  hanjianfei  阅读(19349)  评论(0编辑  收藏  举报