• windows连接远程Oracle数据库


    一、在windows安装Oracle客户端:

    下载地址:https://www.oracle.com/database/technologies/112010-win64soft.html
    ** 选择第二项管理员安装**

    • 问题1:版本错误
      解决:
      修改安装文件:clientstagecvu
      编辑该目录下的两个xml文件:oracle.client_InstantClient.xml和cvu_prereq.xml
      按规律添加以下内容:
    <OPERATING_SYSTEM RELEASE="6.2">
        <VERSION VALUE="3"/>
        <ARCHITECTURE VALUE="64-bit"/>
        <NAME VALUE="Windows 10"/>
        <ENV_VAR_LIST>
            <ENV_VAR NAME="PATH" MAX_LENGTH="5119" />
        </ENV_VAR_LIST>
    </OPERATING_SYSTEM>
    
    • 问题二:安装目录重复
      重新选择安装目录!

    二、安装PL/SQL Developer

    下载地址:https://www.allroundautomations.com/try-it-free/

    三、登录连接Orcle

    • 问题一:没有监听
      修改服务端Oracle的文件:
      一定得备份!!!
      解决办法简述:
    • 1.修改/home/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/listener.ora中的localhost改为192.168.8.13【服务器IP】;
    • 2.修改/home/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/tnsnames.ora中的localhost改为192.168.8.13【服务器IP】;
    • 3.修改后,重启oracle,监听,并注册,主win10上的plsql就可以远程连接虚拟机上的数据库了。

    具体操作步骤如下:

    • 1、修改数据库服务器中listener.ora文件内容
      原始内容:
    # listener.ora Network Configuration File:/home/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
        )
      )
    ADR_BASE_LISTENER = /home/tools/oracle11g
    

    修改后的内容如下:

    # listener.ora Network Configuration File: /home/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/listener.ora# Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
        (SID_LIST =
            (SID_DESC =
                (GLOBAL_DBNAME = orcl)
                (ORACLE_HOME = /home/tools/oracle11g/product/11.2.0/dbhome_1/)
                (SID_NAME = orcl)
            )
        )
    
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.13)(PORT = 1521))
        )
      )
    
    ADR_BASE_LISTENER = /home/tools/oracle11g
    
    • 2、修改数据库服务器中tnsnames.ora文件内容
      原始内容:
    # tnsnames.ora Network Configuration File: /home/tools/oracle11g/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.
    ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
        )
      )
    

    修改后的内容:

    # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.
    
    LISTENER_ORCL =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.183.129)(PORT = 1521))
    
    orcl =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.183.129)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
        )
      )
    
    
    • 添加服务器
      管理员权限运行Net Mananger
      按步骤添加:

      然后按内容添加:

    • 修改windows客户端文件
      使用管理员权限修改:
      D:Oracle11g_Clientproduct11.2.0client_1 etworkadmin
      修改内容为:【核对一下,一般不用修改】

    # tnsnames.ora Network Configuration File: D:Oracle11g_Clientproduct11.2.0client_1NETWORKADMIN	nsnames.ora
    # Generated by Oracle configuration tools.
    
    ORCL =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.183.129)(PORT = 1521))
        )
        (CONNECT_DATA =
          (SERVICE_NAME = orcl)
        )
      )
    

    三、在数据库服务器中启动监听并更新注册

    • 最后重启一下监听与数据库并更新注册
    $ lsnrctl stop        #先关闭监听服务
    $ lsnrctl start        #开启监听服务
    $ sqlplus / as sysdba      #登入
    SQL> shutdown immediate    #立即关闭数据库服务
    SQL> startup        #开启数据库服务
    命令:SQL> alter system register;  #注册
    System altered.
    SQL>
    SQL> quit #登出
    输出:
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    

    四、登录plsql

  • 相关阅读:
    hive 三种启动方式及用途
    Nodejs根据字符串调用对象方法
    Hive原理与不足
    [置顶] 面向领域概念:流的思考
    curl的使用
    mysql知识点总结
    中文字符串反转
    《c陷阱与缺陷》之贪心法
    静态数据成员和静态成员函数
    常成员函数 int fun() const;
  • 原文地址:https://www.cnblogs.com/zzw1024/p/13060424.html
Copyright © 2020-2023  润新知