zoukankan      html  css  js  c++  java
  • linux客户端连接oracle服务器

    环境:

    db:12.2.0.1

    os:centos 7

     

     1. 下载客户端instant

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

     

    我这里下载的是12.2.0.1版本的,需要下载如下两个文件

    instantclient-basic-linux.x64-12.2.0.1.0.zip

    instantclient-sqlplus-linux.x64-12.2.0.1.0.zip

     

    2. 上传客户端机器上解压

    [root@localhost soft]# pwd

    /soft

     

    [root@localhost soft]#unzip instantclient-basic-linux.x64-12.2.0.1.0.zip

    [root@localhost soft]#unzip instantclient-sqlplus-linux.x64-12.2.0.1.0.zip

     

     

    3. 修改环境变量

     

    [root@localhost ~]# more .bash_profile

    # .bash_profile

    # Get the aliases and functions

    if [ -f ~/.bashrc ]; then

            . ~/.bashrc

    fi

    # User specific environment and startup programs

    export ORACLE_HOME=/soft/instantclient_12_2

    export TNS_ADMIN=$ORACLE_HOME

    export LD_LIBRARY_PATH=$ORACLE_HOME/:$LD_LIBRARY_PATH

    PATH=$PATH:$HOME/bin:$ORACLE_HOME

    export PATH

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    4. 配置tnsnames.ora

    在$ORACLE_HOME下创建tnsnames.ora文件,并添加服务器信息

    [root@localhost instantclient_12_2]# more tnsnames.ora

    ora19c =

        (DESCRIPTION =

        (ADDRESS_LIST =

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

        )

        (CONNECT_DATA =

          (SERVER = DEDICATED)

          (SERVICE_NAME = ora19c)

        )

      )

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    5. 登录

    [root@localhost ~]# sqlplus /nolog

     

    SQL*Plus: Release 12.2.0.1.0 Production on Tue Oct 20 09:40:00 2020

     

    Copyright (c) 1982, 2016, Oracle.  All rights reserved.

     

    SQL> connect hxl/oracle@ora19c

    Connected.

     

  • 相关阅读:
    ssm框架搭建
    属性注入
    布隆过滤器
    浅谈动态规划
    双指针技巧汇总
    详解二分查找算法
    java内存模型的实现
    JVM内存结构、Java内存模型和Java对象模型
    浅谈动态规划以及相关的股票问题
    了解重构
  • 原文地址:https://www.cnblogs.com/hxlasky/p/13849302.html
Copyright © 2011-2022 走看看