Oracle数据库连接时,报错,如下:
解决方法:
1.windows系统:管理工具->服务,打开服务,双击OracleServiceXXX(XXX为你的数据库 SID),看查看Oracle安装路径
2.打开数据库实例的目录,例如:D:\****\product\11.2.0\dbhome_1\NETWORK\ADMIN
找到listener.ora文件(listener监听器进程的配置文件),使用文本编辑器打开
添加标红部分:
# listener.ora Network Configuration File: D:\oracle\software\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:\oracle\software\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\oracle\software\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
#这一段是需要增加的,GLOBAL_DBNAME和SID_NAME用查到的sid,ORACLE_HOME与上面该文件的保持一致。
#(ORCL -- 是你的SID 数据库名)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = D:\oracle\software\product\11.2.0\dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = kws-PC)(PORT = 1521))
)
)
ADR_BASE_LISTENER = D:\oracle\software
3.启动OracleServiceXXX(XXX为你的数据库 SID)和OracleOraDb11g_home1TNSListener 即可