当执行下列命令时出现ORA-12514错误
[oracle@edbjr2p1 admin]$ sqlplus system/oracle@PROD
SQL*Plus: Release 11.2.0.4.0 Production on Sat May 3 12:25:27 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
解决:
1.查看listener.ora文件
[oracle@edbjr2p1 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = edbjr2p1.us.oracle.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
2.查看tnsnames.ora文件
[oracle@edbjr2p1 admin]$ cat tnsnames.ora
PROD =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = edbjr2p1.us.oracle.com)
(PORT = 1521)
)
(CONNECT_DATA =
(SERVICE_NAME = PROD.us.oracle.com)
)
)
3.在listener.ora中增加下列几行
[oracle@edbjr2p1 admin]$ vim listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = edbjr2p1.us.oracle.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PROD.us.oracle.com)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = PROD)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
4.测试是否成功
[oracle@edbjr2p1 ~]$ sqlplus system/oracle@PROD
SQL*Plus: Release 11.2.0.4.0 Production on Sat May 3 12:31:20 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
本文出自 “云人生” 博客,请务必保留此出处http://ovcer.blog.51cto.com/1145188/1405719
原文:http://ovcer.blog.51cto.com/1145188/1405719