Oracle10g安装后,尤其是10.2.0版本,基本上都会遇到“ERROR - ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务”这样的错误。
解决的办法如下:
1. 打开Oracle安装目录下的/network/admin/listener.ora文件,通常内容如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E:oracleproduct10.2.0db)
(PROGRAM = extproc)
)
)
……
2. 修改这个文件,增加下面的内容:
(SID_DESC =
(GLOBAL_DBNAME = ORACLE)
(ORACLE_HOME = E:oracleproduct10.2.0db)
(SID_NAME = orcl)
)
这里的orcl换成具体的实例名称。
3.完整的listener.ora文件的内容如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E:oracleproduct10.2.0db)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORACLE)
(ORACLE_HOME = E:oracleproduct10.2.0db)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.18.2)(PORT = 1521))
)
)
这里的172.16.18.2 和 1521换成相应的数据库的IP地址和端口即可。