如何从局域网中的远程计算机连接到 Oracle?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/776228/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 18:06:53  来源:igfitidea点击:

How to connect to Oracle from far Computer in LAN?

c#oracle

提问by Gold

I have Computer A (with IP = 10.20.30.40) which stores the Oracle Database.

我有存储 Oracle 数据库的计算机 A(IP = 10.20.30.40)。

Data Source = ORCL , User = sa , Password = sa

数据源 = ORCL,用户 = sa,密码 = sa



I have Computer B(IP = 10.20.30.44) and I want to connect Computer B to computer A.

我有计算机 B(IP = 10.20.30.44),我想将计算机 B 连接到计算机 A。

How can I do that? What is the Connection string that I need ? Any suggestions

我怎样才能做到这一点?我需要的连接字符串是什么?有什么建议

回答by

What Oracle version do you use?

您使用的是哪个 Oracle 版本?

Usually it is made using direct editing tnsnames.ora file (default location for Oracle 10g client = C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora) or GUI tool -> Net Configuration assistant.

通常使用直接编辑 tnsnames.ora 文件(Oracle 10g 客户端的默认位置 = C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora)或 GUI 工具 -> 网络配置助手来制作。

Example of connection alias from my tnsnames.ora file:

我的 tnsnames.ora 文件中的连接别名示例:

ORADB =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.50.1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ora10gdb)
    )
  )

ORADB - alias name, you use it as a db name when you connecting to a database from your environment

ORADB - 别名,当您从环境连接到数据库时将其用作数据库名称

HOST - is a server host name PORT - is Oracle service port name (1521 is a default port) SERVICE_NAME - is a oracle database instance service name (can be more than one database instance on same server behind same port)

HOST - 是服务器主机名 PORT - 是 Oracle 服务端口名(1521 是默认端口) SERVICE_NAME - 是一个 oracle 数据库实例服务名(可以是同一服务器上的多个数据库实例在同一端口后面)

回答by Mac

If you have a 10+ Oracle client on computer B, you can use the EZCONNECTfeature, which does not require to edit the TNSNAMES.ORA file : sa/[email protected]/1521:ORCL. For instance :

如果您在计算机 B 上有 10+ 个 Oracle 客户端,则可以使用EZCONNECT功能,该功能不需要编辑 TNSNAMES.ORA 文件:sa/[email protected]/1521:ORCL。例如 :

sqlplus sa/[email protected]/1521:ORCL