问题1:ORA-12154: TNS: 无法解析指定的连接标识符
在一台服务器上部署了Oracle客户端,使用IP/SID的方式访问,老是报ORA-12154错误,而使用tnsnames访问却没有问题,对比了我本机的配置并查阅了一下资料,Easy Connect Naming Method这个东西是Oracle 10g推出的,需要在sqlnet.ora文件中添加EZCONNECT,如下:
# sqlnet.ora Network Configuration File: C:\app\Administrator\product\11.2.0\client_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)
问题2:ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
1、通过重启服务的方式启动数据库和监听服务,再次连接仍无法连接服务器。
2、考虑检查监听listener.ora文件的配置
监听配置文件listener.ora中可以不必指定监听的服务名(安装Oracle10g后也是没有指定的)。正常情况下一般只要数据库启动,客户端连接数据库也没有什么问题,但是有时重复启动关闭也会出现ORA-12514错误。
既然listener.ora中没有指定监听,我们可以在listener.ora文件中指定监听的实例名,这样该问题应该可以连接。
# listener.ora Network Configuration File: D:\app\Administrator\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 = C:\app\Administrator\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) (SID_DESC =
(GLOBAL_DBNAME = ora11r2) (SID_NAME = ora11r2)
) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.101)(PORT = 1521)) ) ) ADR_BASE_LISTENER = C:\app\Administrator