oracle 连接数据库报错 ORA-12170:TNS 连接超时
上网尝试了很多方法,网上列举的以下常见方法对于我来说无效,且均正常。
1、先检查网络是否能ping通,下图网络状态是正确的。
2、查看服务器监听服务是否启动
3、cmd -》 tnsping ip地址(或者是服务器的实例名SID)如果报“TNS-12535:操作超时”,可能是服务器端防火墙 没有关闭
4、cmd -》 netstat -na 查看1521端口是否关闭,或者将1521端口设为例外
5、cmd-》 lsnrctl status 查看监听的状态
图中出现监听不支持服务等,基本可以确定D:oracleproduct10.2.0db_1networkadminlistener.ora文件或者tnsnames.ora文件中出现问题
listener.ora文件存在如下代码:
这段代码中HOST是否是你的主机名或者IP,如果不是请修改到对应的主机名和IP 或者localhost
# listener.ora Network Configuration File: D:oracleproduct10.2.0db_1networkadminlistener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:oracleproduct10.2.0db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
tnsnames.ora文件
这段代码中HOST是否是你的主机名或者IP,如果不是请修改到对应的主机名和IP 或者localhost
# tnsnames.ora Network Configuration File: D:oracleproduct10.2.0db_1networkadmintnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
6、我自己解决的
重启如下图所示的两个服务 问题解决