linux下oracle客户端安装

  1. 下载安装包

    zip包(免安装):
    instantclient-sqlplus-linux.x64-11.2.0.4.0.zip
    instantclient-basic-linux.x64-11.2.0.4.0.zip
    instantclient-sdk-linux.x64-11.2.0.4.0.zip
    instantclient-precomp-linux-11.2.0.4.0.zip PRO*C程序开发用到的预编译工具,即proc程序;

  2. 安装解压缩到/home/oracle目录

unzip instantclient-sqlplus-linux.x64-11.2.0.4.0.zip
unzip instantclient-basic-linux.x64-11.2.0.4.0.zip
unzip instantclient-sdk-linux.x64-11.2.0.4.0.zip
unzip instantclient-precomp-linux-11.2.0.4.0.zip
  1. 创建文件夹
#切换到目录:
cd /home/oracle/instantclient_11_2
#创建目录
mkdir -p ./network/admin
  1. 新建tnsnames.ora文件
#新建tnsnames.ora文件
vi tnsnames.ora

#history_162:数据库sid,host:oracle数据库ip,port:oracle数据库端口,SID:数据库的sid
history_162 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.197.1)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SID =xxx)

    )

  )
  1. 配置环境变量
vi .bash_profile

export ORACLE_HOME=/home/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
  1. 测试数据库连接
sqlplus username/passwd@sid
posted @ 2022-10-19 11:23  lim_sy  阅读(2216)  评论(0)    收藏  举报