尝试解决:
1. 监听服务和database instance没有起起来。
开启方法:开始—程序—管理工具—服务,打开服务面板,启动如下图2个服务
2.Oracle本地的配置文件可能被自己不小心改了,检查一下(如果检查服务开了,还是不行)
我的目录:D:\app\renco\product\11.2.0\dbhome_1\NETWORK\ADMIN
,一般后面几层目录名都一样的
-
listener.ora内容
# listener.ora Network Configuration File: D:\app\renco\product\11.2.0\dbhome_1\network\admin\listener.ora # Generated by Oracle configuration tools.SID_LIST_LISTENER =(SID_LIST =(SID_DESC =(SID_NAME = CLRExtProc)(ORACLE_HOME = D:\app\renco\product\11.2.0\dbhome_1)(PROGRAM = extproc)(ENVS = "EXTPROC_DLLS=ONLY:D:\app\renco\product\11.2.0\dbhome_1\bin\oraclr11.dll")))LISTENER =(DESCRIPTION_LIST =(DESCRIPTION =(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))))ADR_BASE_LISTENER = D:\app\renco
-
sqlnet.ora内容
# sqlnet.ora Network Configuration File: D:\app\renco\product\11.2.0\dbhome_1\network\admin\sqlnet.ora # Generated by Oracle configuration tools.# This file is actually generated by netca. But if customers choose to # install "Software Only", this file wont exist and without the native # authentication, they will not be able to connect to the database on NT.SQLNET.AUTHENTICATION_SERVICES= (NTS)NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
-
tnsnames.ora内容(重要!!!!)
# tnsnames.ora Network Configuration File: D:\app\zhouml17060\product\11.2.0\client_1\NETWORK\ADMIN\tnsnames.ora # Generated by Oracle configuration tools.LISTENER_ORCL =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))ORACLR_CONNECTION_DATA =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)))(CONNECT_DATA =(SID = CLRExtProc)(PRESENTATION = RO)))ORCL =(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl)))
我之前就是连公司数据库,使用其他人的tnsnames.ora文件把我自己的替换了,导致本地的配置没了。
增加了本地配置后,就连接成功了。