ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

Linux连接oracle

2022-05-05 11:00:43  阅读:48  来源: 互联网

标签:21.6 x86 el8 64 Linux oracle rpm 连接


1、下载rpm包

https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

oracle-instantclient-basic-21.6.0.0.0-1.el8.x86_64.rpm
oracle-instantclient-sqlplus-21.6.0.0.0-1.el8.x86_64.rpm

2、安装rpm包

RedHat/CentOS直接rpm安装:

rpm -ivh oracle-instantclient-basic-21.6.0.0.0-1.el8.x86_64.rpm

rpm -ivh oracle-instantclient-sqlplus-21.6.0.0.0-1.el8.x86_64.rpm

在Debian/Ubuntu下先将其转成deb包:

alien oracle-instantclient-basic-21.6.0.0.0-1.el8.x86_64.rpm

alien oracle-instantclient-sqlplus-21.6.0.0.0-1.el8.x86_64.rpm

得到:

oracle-instantclient-basic-21.6.0.0.0-1.el8.x86_64.deb

oracle-instantclient-sqlplus-21.6.0.0.0-1.el8.x86_64.deb

然后dpkg安装:

dpkg -i oracle-instantclient-basic-21.6.0.0.0-1.el8.x86_64.deb

dpkg -i oracle-instantclient-sqlplus-21.6.0.0.0-1.el8.x86_64.deb

3、配置oracle连接

创建目录

cd /usr/lib/oracle/21/client64

mkdir network/admin

vim network/admin/tnsnames.ora

ORAL =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = oral)
  )
)

修改profile文件添加环境:

vim /etc/profile

export ORACLE_HOME=/usr/lib/oracle/21/client64
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LD_LIBRARY_PATH=/usr/lib/oracle/21/client64/lib
export PATH=$ORACLE_HOME:$PATH

生效:

source /etc/profile

4、连接oracle

直接连接:

sqlplus username/password@远端ip:端口号/服务名

其他连接方式:

sqlplus /nolog

conn user/password@//ip:port/database

 

标签:21.6,x86,el8,64,Linux,oracle,rpm,连接
来源: https://www.cnblogs.com/JesseGod/p/16223939.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有