出现数据库的连接问题可在命令行下使用 tnsping 服务名 来检查出错原因。
常见错误有:
ORA-12535: TNS: 操作超时
首先关闭防火墙,这是最常见的连接出错原因。
如果仍然不行,检查 tnsnames.ora 文件配置,主要是主机名称是否正确
# TNSNAMES.ORA Network Configuration File: E:\oracle\ora92\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL.DBSE.LAMOST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
)
(CONNECT_DATA =
(SID = orcl)
(SERVER = DEDICATED)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl.dbse.lamost)
)
)
ORA-12541: TNS: 没有监听器
在命令行下执行 lsnrctl start 启动监听器。