database 如何使用 PL/SQL Developer 连接到远程 Oracle DB?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1832908/
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-08 07:31:54  来源:igfitidea点击:

How to connect to remote Oracle DB with PL/SQL Developer?

databaseoracleplsqldeveloperauthentication

提问by Mikhail Orlov

I have a database "TEST", to which I connect at address 123.45.67.89:1521.

我有一个数据库“TEST”,我在地址 123.45.67.89:1521 连接到它。

How do I connect to it using PL/SQL Developer?

如何使用 PL/SQL Developer 连接到它?

回答by dpbradley

In the "database" section of the logon dialog box, enter //hostname.domain:port/database, in your case //123.45.67.89:1521/TEST- this assumes that you don't want to set up a tnsnames.orafile/entry for some reason.

在登录对话框的“数据库”部分,输入//hostname.domain:port/database,在您的情况下//123.45.67.89:1521/TEST- 这假设您tnsnames.ora出于某种原因不想设置文件/条目。

Also make sure the firewall settings on your server are not blocking port 1521.

还要确保服务器上的防火墙设置没有阻止端口1521

回答by Richard Cresswell

I would recommend creating a TNSNAMES.ORA file. From your Oracle Client install directory, navigate to NETWORK\ADMIN. You may already have a file called TNSNAMES.ORA, if so edit it, else create it using your favorite text editor.

我建议创建一个 TNSNAMES.ORA 文件。从您的 Oracle 客户端安装目录,导航到 NETWORK\ADMIN。您可能已经有一个名为 TNSNAMES.ORA 的文件,如果有,请编辑它,否则使用您喜欢的文本编辑器创建它。

Next, simply add an entry like this:

接下来,只需添加如下条目:

MYDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 123.45.67.89)(PORT = 1521))
    (CONNECT_DATA = (SID = TEST)(SERVER = DEDICATED))
  )

You can change MYDB to whatever you like, this is the identifier that applications will will use to find the database using the info from TNSNAMES.

您可以将 MYDB 更改为您喜欢的任何内容,这是应用程序将用于使用来自 TNSNAMES 的信息查找数据库的标识符。

Finally, login with MYDB as your database in PL/SQL Developer. It should automatically find the connection string in the TNSNAMES.ORA.

最后,在 PL/SQL Developer 中使用 MYDB 作为数据库登录。它应该会自动在 TNSNAMES.ORA 中找到连接字符串。

If that does not work, hit Help->About then click the icon with an "i" in it in the upper-lefthand corner. The fourth tab is the "TNS Names" tab, check it to confirm that it is loading the proper TNSNAMES.ORA file. If it is not, you may have multiple Oracle installations on your computer, and you will need to find the one that is in use.

如果这不起作用,请点击“帮助”->“关于”,然后单击左上角带有“i”的图标。第四个选项卡是“TNS Names”选项卡,检查它以确认它正在加载正确的 TNSNAMES.ORA 文件。如果不是,您的计算机上可能有多个 Oracle 安装,您需要找到正在使用的那个。

回答by Ignacio lucatero

The problem is not the TNS file, in PLSQL Developer, if you don't have the oracle installation, you need to provide the location of the OCI.DLL file.

问题不是TNS文件,在PLSQL Developer中,如果你没有安装oracle,需要提供OCI.DLL文件的位置。

In PLSQL DEV app go to Tools-Preferences-Oracle/connections-OCI Library.

在 PLSQL DEV 应用程序中,转到 Tools-Preferences-Oracle/connections-OCI Library。

In my case I put the next address C:\Oracle\InstantClient-win32-11.2.0.1.0\oci.dll.

在我的情况下,我把下一个地址C:\Oracle\InstantClient-win32-11.2.0.1.0\oci.dll

If have Weblogic app installed, I didnt tried but if you want try to put the next location

如果安装了 Weblogic 应用程序,我没有尝试,但如果您想尝试放置下一个位置

C:\Oracle\Middleware\wlserver_10.3\server\adr.

C:\Oracle\Middleware\wlserver_10.3\server\adr.

回答by Laszlo Lugosi

I am facing to this problem so many times till I have 32bitPL/SQL Developer and 64bitOracle DB or Oracle Client.

我多次面临这个问题,直到我拥有32 位PL/SQL Developer 和64 位Oracle DB 或 Oracle 客户端。

The solution is:

解决办法是:

  1. install a 32bit client.
  2. set PLSQL DEV-Tools-Preferencies-Oracle Home to new 32bit client Home
  3. set PLSQL DEV-Tools-Preferencies-OCI to new 32 bit home /bin/oci.dll For example: c:\app\admin\product\11.2.0\client_1\BIN\oci.dll
  4. Save and restart PLSQL DEV.
  1. 安装32位客户端。
  2. 将 PLSQL DEV-Tools-Preferencies-Oracle Home 设置为新的 32 位客户端 Home
  3. 将 PLSQL DEV-Tools-Preferencies-OCI 设置为新的 32 位 home /bin/oci.dll 例如:c:\app\admin\product\11.2.0\client_1\BIN\oci.dll
  4. 保存并重新启动 PLSQL DEV。

Edit or create a TNSNAMES.ORA file in c:\app\admin\product\11.2.0\client_1\NETWORK\admin folder like mentioned above.

如上所述,在 c:\app\admin\product\11.2.0\client_1\NETWORK\admin 文件夹中编辑或创建 TNSNAMES.ORA 文件。

Try with TNSPING in console like

尝试在控制台中使用 TNSPING,例如

C:>tnsping ORCL

C:>tnsping ORCL

If still have problem, set the TNS_ADMIN Enviroment propertiesvalue pointing to the folder where the TNSNAMES.ORA located, like: c:\app\admin\product\11.2.0\client_1\network\admin

如果仍有问题,将TNS_ADMIN 环境属性值设置为指向 TNSNAMES.ORA 所在文件夹,如:c:\app\admin\product\11.2.0\client_1\network\admin

回答by sabre

In addition to Richard Cresswells and dpbradleys answer: If you neither want to create a TNS name nor the '//123.45.67.89:1521/Test' input works (some configurations wont), you can put

除了 Richard Cresswells 和 dpbradleys 的回答:如果您既不想创建 TNS 名称,也不想创建 '//123.45.67.89:1521/Test' 输入工作(某些配置不会),您可以将

(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 123.45.67.89)(PORT = 1521)) (CONNECT_DATA = (SID = TEST)(SERVER = DEDICATED)))

(as one line) into the 'database' section of the login dialog.

(作为一行)进入登录对话框的“数据库”部分。

回答by kajohnsak.m

Username : username
Password : password
Database : //123.45.67.89:1521/TEST
Connect as : Normal

用户名:用户名
密码:密码
数据库://123.45.67.89:1521/TEST
连接为:正常

this work for me and (version 13.0.6.1911 64 bit)

这对我和(版本 13.0.6.1911 64 位)有用