ORA-12505, Tns:listener does not currently know of the SID given in Connect descriptor

Source: Internet
Author: User

Introduction:

The project in the old computer used is oracle10g, new computer installed is oracle11g, but the operation of the project does not have any relationship, originally said to create a user, with Plsql manually import data, Change the configuration file a few more to run--but the following exception was encountered in the actual boot to prevent eclipse from starting:

2016-01-25 11:34:39,694 DEBUG (com.mchange.v2.resourcepool.basicresourcepool:1831)-an exception occurred while Acquiring a poolable resource. Would retry.

java.sql.SQLException: Listener refused the connection with the following error:

ORA-12505, Tns:listener does not currently know of the SID given in Connect descriptor

At Oracle.jdbc.driver.T4CConnection.logon (t4cconnection.java:412)

At oracle.jdbc.driver.physicalconnection.<init> (physicalconnection.java:531)

At oracle.jdbc.driver.t4cconnection.<init> (t4cconnection.java:221)

At Oracle.jdbc.driver.T4CDriverExtension.getConnection (t4cdriverextension.java:32)

At Oracle.jdbc.driver.OracleDriver.connect (oracledriver.java:503)

At Com.mchange.v2.c3p0.DriverManagerDataSource.getConnection (drivermanagerdatasource.java:134)

At Com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection ( wrapperconnectionpooldatasource.java:182)

At Com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection ( wrapperconnectionpooldatasource.java:171)

At Com.mchange.v2.c3p0.impl.c3p0pooledconnectionpool$1pooledconnectionresourcepoolmanager.acquireresource ( c3p0pooledconnectionpool.java:137)

At Com.mchange.v2.resourcepool.BasicResourcePool.doAcquire (basicresourcepool.java:1014)

At com.mchange.v2.resourcepool.basicresourcepool.access$800 (basicresourcepool.java:32)

At Com.mchange.v2.resourcepool.basicresourcepool$acquiretask.run (basicresourcepool.java:1810)

At Com.mchange.v2.async.threadpoolasynchronousrunner$poolthread.run (threadpoolasynchronousrunner.java:547 )

Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:

ORA-12505, Tns:listener does not currently know of the SID given in Connect descriptor

At Oracle.net.ns.NSProtocol.connect (nsprotocol.java:385)

At Oracle.jdbc.driver.T4CConnection.connect (t4cconnection.java:1042)

At Oracle.jdbc.driver.T4CConnection.logon (t4cconnection.java:301)

... More

This exception belongs to the first encounter, and the strange is that I use the CMD panel, plsql, sqldeveloper these several ways to connect the normal, only can be connected to eclipse, and then Baidu a search, there are many answers, but basically is a--modify Oracle's Listener.ora files, such as the following blog post:

http://blog.csdn.net/hxl122lcq/article/details/7542462

However, this method resolves the failure. The resolution of this method of the targeted version is basically 10g, and mine is 11g, but it should not be the cause of the resolution failed.

now that has been resolved, and this is my current Listener.ora files:

# Listener.ora Network Configuration file:d:\oracle11g\product\11.2.0\dbhome_1\network\admin\listener.ora# Generated by Oracle configuration tools. Sid_list_listener=(Sid_list=(Sid_desc=(Sid_name=Clrextproc) (Oracle_home= D:\oracle11g\product\11.2.0\dbhome_1) ( Program=Extproc) (Envs="Extproc_dlls=only:d:\oracle11g\product\11.2.0\dbhome_1\bin\oraclr11.dll")) LISTENER=(Description_list=(DESCRIPTION=(ADDRESS= (PROTOCOL = IPC) (KEY =EXTPROC1521)) (ADDRESS= (PROTOCOL = TCP) (HOST = localhost) (PORT =1521))) Adr_base_listener= D:\oracle11g

above is my current Listener.ora file, also oracle11g default Listener.ora file, Originally I have used the online method to modify this file to the following configuration:

# Listener.ora Network Configuration file:d:\oracle11g\product\11.2.0\dbhome_1\network\admin\listener.ora# Generated by Oracle configuration tools. Sid_list_listener=(Sid_list=(Sid_desc=(Sid_name=Clrextproc) (Oracle_home= D:\oracle11g\product\11.2.0\dbhome_1) ( Program=Extproc) (Envs= "Extproc_dlls=only:d:\oracle11g\product\11.2.0\dbhome_1\bin\oraclr11.dll")) (Sid_desc = (Global_dbname = ORCL) (Oracle_home = D:\oracle11g\product\11.2.0\dbhome_1) (Sid_name = ORCL)) ) LISTENER=(Description_list=(DESCRIPTION=(ADDRESS= (PROTOCOL = IPC) (KEY =EXTPROC1521)) (ADDRESS= (PROTOCOL = TCP) (HOST = 10.127.0.34) (PORT = 1521))) Adr_base_listener= D:\oracle11g

Note: The red font is what's new.

But when did it restore the default configuration? --I don't have a clear (I should not have recovered after the change). Whatever it is, the most important conclusion is that this kind of solution on the internet does not solve my problem! and how did I fix it? In fact, I'm not sure, it should be one of the following nodes, behavior solves this problem. Here's my fix it process:

First, post my related configuration file:

Jdbc.properties (Note: C3P0 is used)

#hibernate. connection.provider_class=Com.jolbox.bonecp.bonecpdatasource#hibernate.connection.provider_class=com.jolbox.bonecp.provider.bonecpconnectionprovider# C3p0hibernate.connection.provider_class=Com.mchange.v2.c3p0.ComboPooledDataSourcehibernate.connection.driver_class=Oracle.jdbc.driver.oracledriver#hibernate.connection.url=jdbc\:oracle\:thin\:@116.252.178.236\:1521\:ORCLhibernate.connection.url=jdbc\:oracle\:thin\: @localhost \:1521 \:ORCLhibernate.connection.username=Mynewdpihibernate.connection.password=Rootbonecp.idlemaxage=6Bonecp.idleconnectiontestperiod=6Bonecp.partitioncount=3bonecp.acquireincrement=5bonecp.maxconnectionsperpartition=6bonecp.minconnectionsperpartition=2bonecp.statementscachesize=5bonecp.releasehelperthreads=3hibernate.dialect= org.hibernate.dialect.Oracle10gDialecthibernate.show_sql=trueHibernate.cache.provider_class=Org.hibernate.cache.EhCacheProviderhibernate.cache.use_query_cache=true

Applicationcontext.xml

     <!--Configuring the BONECP connection pool -    <BeanID= "DataSource"class= "${hibernate.connection.provider_class}" >        < Propertyname= "Driverclass"value= "${hibernate.connection.driver_class}" />        < Propertyname= "Jdbcurl"value= "${hibernate.connection.url}" />        < Propertyname= "User"value= "mynewdpi"/>        < Propertyname= "Password"value= "root"/>    </Bean>

1. Configure environment variables for SIDS

The system variable inside the environment variable new ORACLE_SID
New this environment variable value is ORCL Note: This starts the project, and the exception remains. 2. Take an Oracle small project to do the experiment to connect. This is my download a simple user login, manage the small project: http://download.csdn.net/download/zxl07370330/3469358 put it on Eclipse, create a user, a user and a data, login success!then start the project again, the connection is successful! Summary: Many times, we find the answer on the Internet, generally speaking, the most likely to search the answer is the biggest success rate-but the fact is not always the case. Sometimes, with intuition and experience you will know that an answer is more reliable, although it is not the headline. Sometimes your questions don't belong to the answers that answer the most, so what's your answer--you have to rely on your own hands-on practice. This blog look down should be a very simple thing, but most of the time is in accordance with the Internet said that the article to get to do it or not out- Anyway, the final answer is nothing to do with the Listener.ora file, but it's about setting the SID's environment variable--but I'm not going to be able to reset eclipse, so why not just a small project, and then even a big project? I am not clear, now only at the last to give myself a conjecture: Originally in line with the practice of modifying the Listener.ora file is unsuccessful, and then increase the SID environment variable is not successful, and later in the connection of the small project should be the Listener.ora file restored to the default configuration, coupled with the SID environment variable settings, So it worked.

ORA-12505, Tns:listener does not currently know of the SID given in Connect descriptor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.