1、TNS连接错误
连接oracle数据库报错ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
2、查看本地TNSPING
查看本地E:oracleproduct11.2.0db_1BINNETWORKADMIN nsnames的tns配置:
orcl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
查看本地的tnsping是ok的
C:UsersAdministrator>tnsping orcl
若连接不上,查看tnsnames.ora文件配置是否正确
本地的tnsping暂时看来是正常的,是ok的。
3、查看网络连接
ping 本地ip,也是能进去的,证明网络ok
4、查看服务器的lsnrctl服务
去服务器看lsnrctl状态:lsnrctl status
看到no services,也就是说lsnrctl监听服务启动起来,没有任何oracle实例的,所以问题就来了,没有oracle实例,客户端通过lsnrctl监听的话,就连接不到实例信息。所以这里我们需要添加实例信息,添加实例信息,就在listener.ora配置文件里面。
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = E:oracleproduct11.2.0db_1BIN)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = PC201709030339)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = e:oracleappAdministrator
ORCL =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.67.155)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
5、在listener.ora里面添加实例信息
完善listener.ora配置:
若添加实例还,显示“监听程序当前无法识别连接描述符中请求的服务”错误的话,服务中,查看该数据库的服务是否存在,重新建立服务或者重新建立数据库就行
设置完后,重启监听lsnrctl服务,可以看到会有一个instance服务启动起来了:
Isnrctl status 查看服务起来的动态,及里面存在几个实例(数据库)。