Linux上如何安装sqlplus客户端

Linux上如何安装sqlplus客户端

1.首先到Oracle官方网站下载两个包:

oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm

oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm

2.安装软件包

a)RedHat/CentOS直接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

b)由于是rpm包,在Debian/Ubuntu下先将其转成deb包:

alien oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm

alien oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm

得到

oracle-instantclient11.2-basic-11.2.0.2.0-2_amd64.deb

oracle-instantclient11.2-sqlplus-11.2.0.2.0-2_amd64.deb

然后dpkg安装

dpkg -i oracle-instantclient11.2-basic-11.2.0.2.0-2_amd64.deb

dpkg -i oracle-instantclient11.2-basic-11.2.0.2.0-2_amd64.deb

这样会安装在默认的目录下——/usr/lib/oracle/11.2/client64/

4.安装完成之后,还需要暴露一些环境变量

nano /etc/profile

在最后加上:

export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=$ORACLE_HOME
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib

5.配置TNS连接文件。

cd /usr/lib/oracle/11.2/client64/
vi tnsnames.ora
 
TEST=
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.109)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME=orcl )
    )
  )

6.执行sqlplus,如出现找不到包libaio,到这里下载并安装。

同样的道理Redhat/CentOS直接rpm安装,Debian/Ubuntu转成.deb包后安装。

wget ftp://mirror.switch.ch/pool/3/mirror/centos/4.8/os/x86_64/CentOS/RPMS/libaio-0.3.105-2.x86_64.rpm

6.再执行sqlplus,如果仍然有错,则reboot试试应该就OK了。

sqlplus system/123456@test

Oracle学习笔记:sqlplus用户登录

sqlplus登录Oracle时ORA-01017: invalid username/password; logon denied的错误 

在CentOS 6.4下安装Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虚拟机中安装步骤

Debian 下 安装 Oracle 11g XE R2

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/225f1a94c1c3443f9ba06b63a6f49272.html