使用oracle Sql developer(远程)连接到oracle 12c

时间:2022-05-12 16:48:44

I have been trying to connect to Oracle 12c remotely by using Oracle SQL developer. It shows the below error during connecting to the server :

我一直在尝试使用Oracle SQL developer远程连接Oracle 12c。显示连接服务器时出现以下错误:

 Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection 

I do can connect to oracle database on the server, but the problem is regarding to connect to this server (database) remotely

我可以在服务器上连接到oracle数据库,但是问题是要远程连接到这个服务器(数据库)

The content of my listener.ora is :

我的听众的内容。奥拉是:

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
  (SID_NAME = CLRExtProc)
  (ORACLE_HOME = D:\app\ORCLNEWUSER\product\12.1.0\dbhome_1)
  (PROGRAM = extproc)
  (ENVS =  "EXTPROC_DLLS=ONLY:d:\app\ORCLNEWUSER\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =      
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))     
)
)

1 个解决方案

#1


5  

Your listener.ora says that is only listening on localhost (127.0.0.1), so nothing will be able to connect from anywhere except the server; there is nothing listening on port 1521 on the server's external IP address. You can verify that with lsnrctl status and netstat -ano | find "1521".

你的听众。ora说,这只是在本地主机上监听(127.0.0.1),因此除了服务器以外,任何地方都无法连接;服务器的外部IP地址没有监听端口1521。您可以验证lsnrctl状态和netstat -ano |是否找到“1521”。

You need to modify the listener.ora to listen on your server's hostname, or if that isn't resolvable to the correct IP, the external IP address itself - the 'valid IP address' you're trying to connect to from SQL Developer:

您需要修改侦听器。或者监听服务器的主机名,或者如果不能解析到正确的IP,外部IP地址本身——您试图从SQL Developer中连接到的“有效IP地址”:

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =      
  (ADDRESS = (PROTOCOL = TCP)(HOST = my_hostname_or_ip)(PORT = 1521))     
)
)

You may also need to check that your database is able to register successfully. I'd verify if it is included in lsnctrl services before and after you make that change and restart the listener. If it doesn't appear after the restart, and alter system register doesn't make it appear, then you might need to change the local_listener database parameter to tell it the address and port it should register against. That's a separate issue really but could follow on from this change; there's an example here which might help if it does.

您还可能需要检查数据库是否能够成功注册。我将验证它是否包含在lsnctrl服务中,在您进行更改并重新启动侦听器之前和之后。如果它在重新启动后没有出现,而alter system register也没有出现,那么您可能需要更改local_listener数据库参数,以告诉它应该注册的地址和端口。这确实是一个单独的问题但是可以从这个变化中继续;这里有个例子可能会有帮助。

#1


5  

Your listener.ora says that is only listening on localhost (127.0.0.1), so nothing will be able to connect from anywhere except the server; there is nothing listening on port 1521 on the server's external IP address. You can verify that with lsnrctl status and netstat -ano | find "1521".

你的听众。ora说,这只是在本地主机上监听(127.0.0.1),因此除了服务器以外,任何地方都无法连接;服务器的外部IP地址没有监听端口1521。您可以验证lsnrctl状态和netstat -ano |是否找到“1521”。

You need to modify the listener.ora to listen on your server's hostname, or if that isn't resolvable to the correct IP, the external IP address itself - the 'valid IP address' you're trying to connect to from SQL Developer:

您需要修改侦听器。或者监听服务器的主机名,或者如果不能解析到正确的IP,外部IP地址本身——您试图从SQL Developer中连接到的“有效IP地址”:

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =      
  (ADDRESS = (PROTOCOL = TCP)(HOST = my_hostname_or_ip)(PORT = 1521))     
)
)

You may also need to check that your database is able to register successfully. I'd verify if it is included in lsnctrl services before and after you make that change and restart the listener. If it doesn't appear after the restart, and alter system register doesn't make it appear, then you might need to change the local_listener database parameter to tell it the address and port it should register against. That's a separate issue really but could follow on from this change; there's an example here which might help if it does.

您还可能需要检查数据库是否能够成功注册。我将验证它是否包含在lsnctrl服务中,在您进行更改并重新启动侦听器之前和之后。如果它在重新启动后没有出现,而alter system register也没有出现,那么您可能需要更改local_listener数据库参数,以告诉它应该注册的地址和端口。这确实是一个单独的问题但是可以从这个变化中继续;这里有个例子可能会有帮助。