Oracle - ORA-12505, TNS:listener does not currently know of SID given in connect descriptor 解决

简介: java.sql.SQLException: Listener refused the connection with the following error:ORA-12505, TNS:listener does not currently know of SID given in connect descriptorThe Connection descriptor used b
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
192.168.149.128:1521:orcl
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
 at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
 at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
 at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
 at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
 at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
 at oracle.eclipse.tools.database.connectivity.db.OracleJDBCConnection.createConn(OracleJDBCConnection.java:199)
 at oracle.eclipse.tools.database.connectivity.db.OracleJDBCConnection.createConnection(OracleJDBCConnection.java:149)
 at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:104)
 at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:53)
 at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:72)
 at oracle.eclipse.tools.database.connectivity.db.OracleJDBCConnectionFactory.createConnection(OracleJDBCConnectionFactory.java:42)
 at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83)
 at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:355)
 at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76)
 at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59)
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
 
 
原因/解决方法:
1、分析Oracle的启动过程,没有发现问题,其启动信息如下:
oracle@suse10:~> lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 17-APR-2010 17:05:04

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Starting /app/oracle/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /app/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /app/oracle/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=suse10.site)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                17-APR-2010 17:05:06
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /app/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /app/oracle/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=suse10.site)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
oracle@suse10:~> sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 17 17:05:07 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  436207616 bytes
Fixed Size                  1219832 bytes
Variable Size             125829896 bytes
Database Buffers          301989888 bytes
Redo Buffers                7168000 bytes
Database mounted.
Database opened.

2、在sqlplus中查询数据,同样正常:

oracle@suse10:/app/oracle/oracle/product/10.2.0/db_1/network/admin> sqlplus servicemn/servicemn

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 17 18:56:50 2010
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select abstract_service_code,status,perdefined from abstract_service;    

  ABSTRACT_SERVICE_CODE     STATUS PERDEFINED
  --------------------- ---------- ----------
                   1001          1          1
                   1002          1          0
                   7777          5          0
                   2002          1          0
             4.4444E+15          5          0
                   8888          5          0
                   1003          5          0
                   2001          1          0
                   1109          5          0
                      1          5          0
                   9999          5          0
  11 rows selected.
  
看来,数据库是没有问题的,那问题应该出在了监听器上。

3、打开Oracle的 listener.ora 文件:
# listener.ora Network Configuration File: /app/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /app/oracle/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = suse10.site)(PORT = 1521))
    )
  )
修改它的 SID_LIST_LISTENER 中的内容,修改后的内容如下:
# listener.ora Network Configuration File: /app/oracle/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /app/oracle/oracle/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = /app/oracle/oracle/product/10.2.0/db_1)
(SID_NAME = ORCL)
) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) (ADDRESS = (PROTOCOL = TCP)(HOST = suse10.site)(PORT = 1521)) ) )
Oracle - ORA-12505, TNS:listener does not currently know of SID given in connect descriptor 解决 - 傲风 - 上面的粗体文字是增加的内容。

4、重启Oracle的监听器。

目录
相关文章
|
存储 Oracle 关系型数据库
ORACLE:根据父id查询所有子孙数据,或者根据子id查询所有父数据(start with connect by prior)
一、需求: 我们在开发中经常遇到一种数据库表的设计:一个表中包含父子信息数据,也就是常说的树形数据. —> 最常见的例子就是省市区一体表,就是通过id、pid、level来进行控制,从而一张表来存储数据.我们进行拿数据的时候,不用再连表拿取,直接通过(start with connect by prior)直接便利就会得到数据.
745 2
ORACLE:根据父id查询所有子孙数据,或者根据子id查询所有父数据(start with connect by prior)
|
2月前
|
Oracle 关系型数据库
oracle的start with connect by prior如何使用 整理
oracle的start with connect by prior如何使用 整理
|
6月前
|
存储 数据采集 Oracle
oracle connect by很强,但是要慎用,不然有你哭的时候
oracle connect by很强,但是要慎用,不然有你哭的时候
228 0
|
6月前
|
SQL Oracle 关系型数据库
Connect to Autonomous Database Using Oracle Database Tools
Connect to Autonomous Database Using Oracle Database Tools
61 1
|
Oracle 关系型数据库 数据安全/隐私保护
Oracle 10g ORA-12154: TNS: could not resolve the connect identifier specified 问题解决! 我同事遇到的问题。 用户名/
Oracle 10g ORA-12154: TNS: could not resolve the connect identifier specified 问题解决! 我同事遇到的问题。 用户名/
|
SQL Oracle 关系型数据库
Oracle 使用DB link update table & TNS:linstener was not given the servicename in connect_data处理方式
业务需求:需要在Oracle1 的A表增加一个字段,这个字段来自于Oracle2 的B表的一个字段。
112 0
|
Oracle 安全 关系型数据库
ORACLE 11g【安装流程】及部门问题解决,ORA-12514: TNS:监听程序当前无法识别连接描述符中请求的服务 下
ORACLE 11g【安装流程】及部门问题解决,ORA-12514: TNS:监听程序当前无法识别连接描述符中请求的服务 下
231 0
ORACLE 11g【安装流程】及部门问题解决,ORA-12514: TNS:监听程序当前无法识别连接描述符中请求的服务   下
|
SQL Oracle 关系型数据库
ORACLE 11g【安装流程】及部门问题解决,ORA-12514: TNS:监听程序当前无法识别连接描述符中请求的服务 上
ORACLE 11g【安装流程】及部门问题解决,ORA-12514: TNS:监听程序当前无法识别连接描述符中请求的服务 上
515 0
ORACLE 11g【安装流程】及部门问题解决,ORA-12514: TNS:监听程序当前无法识别连接描述符中请求的服务   上
|
存储 SQL Oracle
Oracle的学习心得和知识总结(五)|Oracle数据库 Connect By 技术详解
Oracle的学习心得和知识总结(五)|Oracle数据库 Connect By 技术详解
342 0
Oracle的学习心得和知识总结(五)|Oracle数据库 Connect By 技术详解
|
Oracle 关系型数据库 数据库
Oracle的学习心得和知识总结(五)|Oracle数据库 Connect By 技术详解
本人CSDN博主 孤傲小二~阿沐,本文《Oracle的学习心得和知识总结(五)|Oracle数据库 Connect By 技术详解》来自于我在CSDN的同名文档