【发布时间】:2020-12-13 04:15:03
【问题描述】:
我在这里真的需要帮助。我在 VirtualBox VM 上设置了一个 Oracle 数据库服务器,直到昨天一切似乎都运行良好。今天,当我启动数据库以继续工作,并在我的本地机器(客户端机器)中打开 SQLDeveloper 时,它向我抛出了这个错误:
Erro de ES: The Network Adapter could not establish the connection
我的 VirtualBox VM 网络设置配置为 bridged adapter。而且我能够很好地连接,今天开始出现这个错误。
我做了一些研究,但没有一个对我有用。试图遵循这个家伙的解决方案:
Oracle SQL Developer: Failure - Test failed: The Network Adapter could not establish the connection?
并且效果不佳。我将在此处分享我的lsnrctl status 和我的文件,以便您查看。
首先这是我开始设置的方式:
1. lsnrctl start 启动监听器。结果:
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 24-AUG-2020 10:40:56
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 24-AUG-2020 10:40:56
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
2。 sqlplus / as sysdba 启动 sqlplus shell,然后 startup 启动数据库实例,给出:
ORACLE instance started.
Total System Global Area 2550136832 bytes
Fixed Size 8623928 bytes
Variable Size 671090888 bytes
Database Buffers 1862270976 bytes
Redo Buffers 8151040 bytes
Database mounted.
Database opened.
然后我的lsnrctl status 给出:
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 24-AUG-2020 10:46:34
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 24-AUG-2020 10:40:56
Uptime 0 days 0 hr. 5 min. 38 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=dbserver)(PORT=5500))(Security=(I removed the path for security))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
我的listener.ora:
# listener.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
我的tnsnames.ora:
GNU nano 2.9.8 tnsnames.ora Modified
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
当我尝试通过安装在虚拟机(即服务器端)内的 SQLDeveloper 连接数据库时,它工作正常,但是当我尝试从本地机器(客户端)上的 SQLDeveloper 连接时,我抛出错误。 我看到的每个帖子都告诉我要查看侦听器状态,但我认为这不是问题。
如果有任何帮助,我将不胜感激。非常感谢您,我在这里回答任何其他信息。 =D
编辑:忘了说我使用的是 12c 版的 Oracle 数据库
编辑:当我ping 数据库的主机时,我得到这个:
[oracle@dbserver admin]$ ping dbserver
PING dbserver(dbserver (fe80::f8dd:c03c:920c:5442%enp0s3)) 56 data bytes
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=1 ttl=64 time=0.075 ms
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=2 ttl=64 time=0.053 ms
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=3 ttl=64 time=0.051 ms
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=4 ttl=64 time=0.072 ms
64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=5 ttl=64 time=0.049 ms
^C
--- dbserver ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 131ms
rtt min/avg/max/mdev = 0.049/0.060/0.075/0.011 ms
【问题讨论】:
-
SQL*Developer 连接属性中的主机名是什么?你能
ping那个主机名/IP地址吗?你是给你的虚拟机一个静态 IP 地址还是让它通过 DHCP 分配一个?我认为您关闭了您的虚拟机,当您重新启动它时,它会返回一个新的 IP 地址。 -
当然!结果如下:
[oracle@dbserver admin]$ ping dbserver PING dbserver(dbserver (fe80::f8dd:c03c:920c:5442%enp0s3)) 56 data bytes 64 bytes from dbserver (fe80::f8dd:c03c:920c:5442%enp0s3): icmp_seq=1 ttl=64 time=0.075 ms``` --- dbserver ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 131ms rtt min/avg/max/mdev = 0.049/0.060/0.075/0.011 ms@MatthewMcPeak 我在问题中添加了一个编辑,这样您就可以获得更易读的结果 -
最简单的方法是创建一个从你的主机转发到 1521 上的虚拟机的端口,然后你可以简单地连接到 localhost:1521
-
@thatjeffsmith 你能说明一下我该怎么做吗?
-
确定@LeonardoGuerreiro,看看我的回答
标签: oracle oracle-sqldeveloper oracle12c