码迷,mamicode.com
首页 > 数据库 > 详细

windows连接远程Oracle数据库

时间:2020-06-07 14:52:18      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:list   sys   运行   admin   reg   protoc   cti   sof   image   

一、在windows安装Oracle客户端:

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

  • 问题1:版本错误
    解决:
    修改安装文件:\client\stage\cvu
    编辑该目录下的两个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_Client\product\11.2.0\client_1\network\admin
    修改内容为:【核对一下,一般不用修改】

# tnsnames.ora Network Configuration File: D:\Oracle11g_Client\product\11.2.0\client_1\NETWORK\ADMIN\tnsnames.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

技术图片

windows连接远程Oracle数据库

标签:list   sys   运行   admin   reg   protoc   cti   sof   image   

原文地址:https://www.cnblogs.com/zzw1024/p/13060424.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!