网络适​​配器无法在 SQL developer 中建立连接

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

The Network Adapter could not establish the connection in SQL developer

sqldatabase-connectionoracle-sqldeveloper

提问by Dhivya

I created a database using SQL developer list of 1000 entries and it created successfully. The connection also succeeded. But today while I'm trying to connect there is an error occurring:

我使用包含 1000 个条目的 SQL 开发人员列表创建了一个数据库,并且创建成功。连接也成功了。但是今天当我尝试连接时出现错误:

IO Error: The Network Adapter could not establish the connection in SQL developer

I can surely say it is not connecting I tried it in Command promptalso in prompt it is mentioning as Protocol Adapter Error.

我可以肯定地说它没有连接我Command prompt也在提示中尝试过它被称为协议适配器错误。

What is the problem here?

这里有什么问题?

What is meant by Protocol Adapter Error how can i overcome it?

协议适配器错误是什么意思我怎样才能克服它?

What is Network Adapter Error?

什么是网络适配器错误?

回答by Rahul Tripathi

Please check the listener to see if it is down:-

请检查监听器是否关闭:-

ps -ef | grep tns

If you dont find the output of the listener then you have to start it. To do that type startin the LSNRCTL>prompt.

如果你没有找到监听器的输出,那么你必须启动它。要做到这一点start,请在LSNRCTL>提示中输入。

From the Oracle forum:

来自Oracle 论坛

If the Oracle clients have been installed with 11.1.2.3 the TNS_ADMIN will be point to \user_projects\config\dbclient In that folder there should be a tnsnames.ora, if the Oracle DB is on the same machine you may want to copy the contents of database tnsnames folder to the TNS_ADMIN folder or as suggested change the environment variable.

如果 Oracle 客户端安装了 11.1.2.3,TNS_ADMIN 将指向 \user_projects\config\dbclient 在该文件夹中应该有一个 tnsnames.ora,如果 Oracle DB 在同一台机器上,您可能想要复制内容数据库 tnsnames 文件夹到 TNS_ADMIN 文件夹或按照建议更改环境变量。

回答by scv

I had a similar issue where I also continuously got the same error. I tried many things like changing the listener port number, turning off the firewall etc. Finally I was able to resolve the issue by changing listener.ora file. I changed the following line:

我有一个类似的问题,我也不断遇到同样的错误。我尝试了很多事情,例如更改侦听器端口号、关闭防火墙等。最后我能够通过更改 listener.ora 文件来解决问题。我更改了以下行:

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

(地址 = (协议 = TCP)(主机 = 本地主机)(端口 = 1521))

to

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

(地址 = (协议 = TCP)(主机 = 主机名)(端口 = 1521))

I also added an entry in the /etc/hosts file.

我还在 /etc/hosts 文件中添加了一个条目。

you can use Oracle net manager to change the above line in listener.ora file. See Oracle Net Services Administrator's Guide for more information on how to do it using net manager.

您可以使用 Oracle 网络管理器更改 listener.ora 文件中的上述行。有关如何使用网络管理器执行此操作的更多信息,请参阅 Oracle 网络服务管理员指南。

Also you can use the service name (database_name.domain_name) instead of SID while making the connnection.

您也可以在进行连接时使用服务名称 (database_name.domain_name) 而不是 SID。

Hope this helps.

希望这可以帮助。

回答by Hemanth Kumar

the answer for your question is some times the listener will be shut-down at this point it will not allow you to connect to the database, for example when the machine restarts. Solution is : Go to services check the Oracle_ora Db --> tns_listener is in running mode are not if not restart the services.

您的问题的答案是有时侦听器会在此时关闭,它不允许您连接到数据库,例如当机器重新启动时。解决方法是:去服务检查Oracle_ora db --> tns_listener is in running mode 不重启服务就不行。

回答by Robert

SQL Developer problem: The network adapter could not establish the connection

SQL Developer 问题:网络适配器无法建立连接

  1. Open the file sqldeveloper.conf in wordpad or your favourite text editor. The file is placed in the installation directory, probably:

    %programfiles%\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf
    
  2. Add the following line at the bottom of the file and save:

    AddVMOption -Djava.net.preferIPv4Stack=true
    
  3. Restart SQL Developer.
  1. 在写字板或您喜欢的文本编辑器中打开文件 sqldeveloper.conf。文件放在安装目录下,大概是:

    %programfiles%\sqldeveloper\sqldeveloper\bin\sqldeveloper.conf
    
  2. 在文件底部添加以下行并保存:

    AddVMOption -Djava.net.preferIPv4Stack=true
    
  3. 重新启动 SQL Developer。

回答by Ananta Chandra Das

You need to follow few steps .

您需要遵循几个步骤。

  1. Go to the directory "C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN"
  2. Open tnsnames.orafile and change the host. Generally localhostin your case

    XE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
    )
    
  3. Open listener.orafile and change the listener host name to localhost.

    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    )
    
  4. Open command prompt as administrator. Check for the listener status.

    c:\> lsnrctl status
    

    If you find listener is up then you can be able to connect to the sql developer. Other wise start the listener by using below command.

    c:\> lsnrctl start
    

    Now you can be able to login to sql developer without the above mentioned error.

  1. 进入目录“C:\oraclex\app\oracle\product\11.2.0\server\network\ADMIN”
  2. 打开tnsnames.ora文件并更改主机。在您的情况下通常是本地主机

    XE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
    )
    
  3. 打开listener.ora文件并将侦听器主机名更改为localhost

    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
    )
    
  4. 以管理员身份打开命令提示符。检查侦听器状态。

    c:\> lsnrctl status
    

    如果您发现侦听器已启动,则您可以连接到 sql 开发人员。否则,请使用以下命令启动侦听器。

    c:\> lsnrctl start
    

    现在您可以登录 sql developer 而不会出现上述错误。

回答by ssv

I had a similar issue with oracle running on my suse vm. This fixed the problem: 1.) Removed the file listener.ora. 2.) Made listener part of tnsnames.ora

我的 suse vm 上运行的 oracle 也有类似的问题。这解决了问题: 1.) 删除了文件 listener.ora。2.) 使侦听器成为 tnsnames.ora 的一部分

LISTENER_MDB1 =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

MDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = MDB1)
    )
  )

There may be a better solution though.

不过可能有更好的解决方案。

回答by Vlad

In my case I need to set Hostname like "my-oracle-server-name", not by ip (192.168.1.23)

在我的情况下,我需要将主机名设置为“my-oracle-server-name”,而不是通过 ip (192.168.1.23)