求救..
ORA-12154: TNS:could not resolve the connect identifier specified~~搞了好久了没解决!
我装的是Oracle10G企业版。数据库也在本机。已将DMP成功导入数据库,但是当用PL\SQL登录时,出现
ORA-12154错误。我也查了一些资料,但是好像都没什么效果。下面把相关设置和问题描述一下,希望你们帮我解决下。
1.环境变量。
查看了注册表,是正确的
ORACLE_HOME c:\oracle\product\10.1.0\Db_1
2.SQLPLUS
输入connect,然后按照提示输入用户名和密码后,显示Connected
但是输入connect user/password@orcl后,显示的也是ORA-12154错误,并出现Warning: You are no longer connected to ORACLE.
3.确定监听服务已经起来。
4.用户名和密码确定正确
5.我的tnsnames.ora文件内容如下:
Java code
# tnsnames.ora Network Configuration File: c:\oracle\product\10.1.0\Db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = XP-200907172259)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
6.sqlnet.ora文件内容如下
Java code
# sqlnet.ora Network Configuration File: c:\oracle\product\10.1.0\Db_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
7.listener.ora文件如下:
Java code
# listener.ora Network Configuration File: c:\oracle\product\10.1.0\Db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = c:\oracle\product\10.1.0\Db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = XP-200907172259)(PORT = 1521))
)
)
)
请帮我找出原因,这个问题搞的我快要吐了。。
谢谢!
------解决方案--------------------
再可以看看lsnrctl status是否正常,如果都是正确的。。。
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = c:\oracle\product\10.1.0\Db_1)
(PROGRAM = extproc)
)
)
修改为:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
#(SID_NAME = PLSExtProc)
(SID_NAME = orcl)
(ORACLE_HOME = c:\oracle\product\10.1.0\Db_1)
#(PROGRAM = extproc)
)
)
又如何,再不行的话,使用netca重建。。。
------解决方案--------------------
邪了,用netca把服务名删除掉,lsnrctl stop,将tnsname.ora,listener.ora移到别处去,lsnrctl stop,shutdown immediate, startup, lsnrctl start, 再netca配个。。。
------解决方案--------------------Linster.ora 文件可以备份一下删除,然后先起监听,再起数据库,10g可以自动注册上去.
Listener 和 Tnsname中也许有其他隐性字符,删除后用netca或netmgr重配,其中的Host尽量用本机IP地址配置.
------解决方案--------------------把tnsname重新创建一次,以避免有ctrl-M(^M)等类似于这样的字符.
你的机器名是?
------解决方案--------------------SQLNET.AUTHENTICATION_SERVICES= (NTS)
改成:SQLNET.AUTHENTICATION_SERVICES= (NONE)