赞
踩
ORA-12514的故障是很多新手在连接Oracle数据库时经常遇到故障,它通常表示无法连接到数据库实例,这里姚远老师告诉大家如何排除这类故障。
当尝试连接到Oracle数据库实例时,可能会收到ORA-12514错误消息。此错误通常会在Oracle客户端或应用程序中显示。
此外,还可能会在数据库服务器上的日志文件中看到类似于以下消息的记录:
TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
ORA-12514错误通常是由以下原因之一造成的:
oracle@Yao ~$ sqlplus sys/yaoyuan@localhost/orc1 as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Mar 1 16:00:59 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
oracle@yaoyuan ~$ sqlplus sys/yaoyuan@localhost/scott as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Mar 1 16:16:54 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-12541: TNS:no listener
注意:这里的提示是“no listener”,和前面的“listener does not currently know of service requested in connect descriptor”不同。
针对ORA-12514错误,可以采取以下措施来解决问题:
oracle@Yao ~$ sqlplus sys/yaoyuan@localhost/orc1 as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Mar 1 16:29:24 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
Enter user-name:
oracle@Yao ~$ sqlplus sys/yaoyuan@localhost/orcl as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Mar 1 16:29:40 2023
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
仔细看看就明白了,原来服务名是orcl被错误的写成了orc1。当然在生产环境,大部分时候服务名是在tnsnames.ora文件中配置的:
oracle@yaoyuan ~$ cat /u01/app/oracle/product/19.3.0/db_1/network/admin/tnsnames.ora
...
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracleace)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orc1)
)
)
注意这里的SERVICE_NAME中有个不容易察觉的错误。
其它可能的问题和对应的解决方法包括:
这篇文章解决了您不能连接Oracle数据库的问题吗?如果没有解决,您可以在下面留言描述您的问题,我会尽量抽时间给您解答,或者您可以加下方我的微信
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。