解决Oracle ORA-12505, TNS:listener does not currently know of SID given in connect(转)
http://anthon-lx.iteye.com/blog/811460
完整的错误信息如下:
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)
解决方法:
打开Oracle的 listener.ora 文件:
(oracle/oracle/product/10.2.0/db_1/network/admin/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))
)
)
------------------------------------------------------------------------------------------------------------------------------
修改后:
# 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))
)
)
上面的红色文字是增加的内容。 (ORCL -- 是你的SID
数据库名)
重启Oracle的监听器。
问题解决。
解决Oracle ORA-12505, TNS:listener does not currently know of SID given in connect(转),码迷,mamicode.com