ORA-12505, TNS : listener가 현재 연결 설명자에 제공된 SID를 알지 못합니다.
Windows 7 64 비트 OS에 Oracle 11g Express Edition 릴리스 2를 설치하고 JDBC 프로그램을 실행하려고 시도한 후 다음 오류가 발생했습니다.
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
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 java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.jlcindia.jdbc.JDBCUtil.geOracleConnection(JDBCUtil.java:28)
at Lab3O.main(Lab3O.java:15)
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of 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)
... 8 more
내 jdbc 문자열을 수정 하여이 문제를 해결했습니다.
예를 들어, 올바른 jdbc 문자열은 다음과 같아야합니다.
jdbc:oracle:thin:@myserver:1521/XE
하지만 내가 사용하는 jdbs 문자열은 ...
jdbc:oracle:thin:@myserver:1521:XE
(참고 : 사이 1521
및 사이 XE
여야 함 /
)
이 잘못된 jdbc 문자열은 ORA-12505 오류도 발생시킵니다.
이 문제점을 일으킬 수있는 몇 가지 사항이 있지만 JDBC를 시작하기 전에 SQL * Plus를 사용하여 데이터베이스에 연결할 수 있는지 확인해야합니다. SQL * Plus에 익숙하지 않은 경우 오랫동안 Oracle의 표준 부분 인 Oracle 데이터베이스에 연결하기위한 명령 줄 도구이며 Oracle XE에 포함되어 있습니다.
JDBC를 사용하여 Oracle 데이터베이스에 연결하면 데이터베이스에 직접 연결되지 않습니다. 대신 TNS 리스너에 연결 한 다음 데이터베이스에 연결합니다. 오류 ORA-12505
는 리스너가 작동하여 연결할 수 있지만 해당 데이터베이스가 작동 중인지 알 수 없으므로 데이터베이스에 연결할 수 없음을 의미합니다. 이에 대한 두 가지 이유가 있습니다.
- 데이터베이스가 시작되지 않았습니다.
- 리스너 전에 데이터베이스가 시작 되었기 때문에 데이터베이스가 리스너에 등록되지 않았습니다. (데이터베이스가 시작되면 이미 실행중인 경우 리스너에 자체 등록됩니다. 리스너가 실행 중이 아닌 경우 데이터베이스는 자체적으로 등록되지 않으며 리스너가 시작되면 데이터베이스를 찾지 않습니다. 등록하십시오.)
ORA-12505는 청취자가 그 데이타베이스에 대해 알고 있지만, 데이타베이스로부터 데이타베이스가 가동되었다는 통지를받지 못했습니다. (잘못된 SID를 사용하여 잘못된 데이터베이스에 연결하려고하면 ORA-12154 오류 "TNS : 지정된 연결 식별자를 확인할 수 없습니다"가 표시됩니다.)
서비스 스냅인에서 실행중인 Oracle 서비스는 무엇입니까? (제어판> 관리 도구> 서비스에서이를 열거 나 시작> 실행>을 누르십시오 services.msc
.) OracleServiceXE 및 OracleXETNSListener 서비스를 실행 해야합니다.
서비스가 모두 시작된 경우 명령 프롬프트에서 다음 중 하나를 사용하여 SQL * Plus에서 데이터베이스에 연결할 수 있습니까? (Oracle XE를 설치 한 머신에서 이들을 실행한다고 가정합니다.)
sqlplus 시스템 / 시스템 암호 @XE
sqlplus 시스템 / 시스템 암호
sysplusba로 sqlplus /
( system-password
Oracle XE 설치 중에 SYS 및 SYSTEM 사용자에 대해 설정 한 비밀번호로 바꾸십시오.)
이 세 개 중 첫 번째는 TNS 리스너를 통해 연결되지만 두 번째 두 개는 리스너를 거치지 않고 데이터베이스에 직접 연결되며 데이터베이스와 동일한 시스템에있는 경우에만 작동합니다. 첫 번째는 실패하지만 다른 두 개는 성공하면 JDBC 연결도 실패합니다. 그렇다면 다른 둘 중 하나를 사용하여 데이터베이스에 연결하고을 실행하십시오 ALTER SYSTEM REGISTER
. 그런 다음 SQL * Plus를 종료하고 첫 번째 양식을 다시 시도하십시오.
세 번째는 실패하지만 두 번째는 실패하면 사용자 계정을 ora_dba 그룹에 추가하십시오. 제어판> 컴퓨터 관리> 로컬 사용자 및 그룹에서이 작업을 수행하십시오.
일단 양식의 연결을 얻을 수 있습니다
sqlplus 시스템 / 시스템 암호 @XE
작동하려면 JDBC를 통해 Oracle XE에 연결할 수 있어야합니다. (실수로 데이터베이스에 연결하는 데 사용하는 JDBC 코드를 표시하지는 않았지만 아마도 올바른 것으로 생각됩니다. 연결 문자열의 일부가 잘못되면 다양한 다른 오류가있을 수 있습니다.)
나도 같은 오류가 있었지만 시도했을 때 세 가지 모두가 실패했습니다. 이 서비스 (내 경우에는 XE)를 발견하면 세 fails.Try LSNRCTL 상태 위의 누락이 시도하는 경우 이제 서비스를 볼 수있는 이 일을 시도해 볼 수 없다하더라도sqlplus /nolog conn system ... password ... connected. alter system register;
exit
lsnrctl stat
...
sqlplus /nolog
conn system
... password ... connected.
alter system set local_listener = '(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))' scope = both;
... system altered ...
alter system register;
exit
lsnrctl stat
이것은 아마도 작동해야합니다 ...
이 오류가 발생하면 "ORA-12505, TNS : listener가 현재 연결 설명자에 제공된 SID를 알 수 없습니다"
해결 방법 : 서비스를 열고 시작한 OracleServiceXE
후 연결을 시도하십시오 ...
이 예외에 대한 몇 가지 이유를 발견했습니다.
1) 기본적으로 데이터베이스 XE의 이름. URL은 " jdbc : oracle : thin : @localhost : 1521 : XE "입니다.
2) OracleServiceXE, OracleXETNSListener가 실행 중인지 확인하십시오. 제어판 \ 모든 제어판 항목 \ 관리 도구 \ 서비스에 있습니다.
JDBC 코드를 수정하여이 문제를 해결했습니다.
올바른 JDBC 문자열은 ...
conection = DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:xe","system","ishantyagi");
그러나 내가 사용했던 JDBC 문자열은 ...
conection = DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:orcl","system","ishantyagi");
따라서 xe 대신 orcl을 지정하는 실수는 SID 이름이 잘못 되었기 때문에이 오류를 나타 냈습니다.
아래 코드를 사용하면 문제가 해결됩니다.
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@IPAddress:1521/servicename","userName","Password");
비슷한 오류가 발생하여 위의 솔루션 중 어느 것도 도움이되지 않았습니다. listner.ora 파일에 문제가있었습니다. 실수로 내가 추가 한 SID
의 출력 SID_LIST
(별 * 사이의 부분) 아래를 참조하십시오.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
*(SID_DESC =
(SID_NAME = XE)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
)*
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
다음과 같이이 오류를 수정했습니다.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = XE)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
제어판 \ 모든 제어판 항목 \ 관리 도구 \ 서비스로 이동하여 자동으로 중지되지 않으므로 리스너 OracleServiceXE 및 OracleXETNSListener를 수동으로 중지했습니다. 데이터베이스를 다시 시작했는데 매력처럼 작동했습니다.
i initially came here with the same problem. I had jus installed Oracle 12c on Windows 8 (64-bit),but i have since resolved it by 'TNSPING xe' on the command line... If the connection isn't established or name not found,try the database name,in my case it was 'orcl'... 'TNSPING orcl' again and if it pings successfully then u need to change the SID to 'orcl' in this case (or whatever database name u used)...
One possibility that I haven't seen widely discussed is that there may be a problem resolving the hostname on the host machine itself. If there is no entry for $(hostname) in /etc/hosts, the Oracle listener gets confused and wont come up.
That turned out to be my problem, and adding the hostname and ip address in /etc/hosts resolved the problem.
Oracle: Thin-style Service Name Syntax
Thin-style service names are supported only by the JDBC Thin driver. The syntax is:
@//host_name:port_number/service_name
http://docs.oracle.com/cd/B28359_01/java.111/b31224/urls.htm#BEIDHCBA
I too faced the same issue. I had installed Oracle Express edition 10g in Windows XP OS using VMware and it was working fine. Since it was very awkward typing SQL queries in the SQL utility provided by 10g and since I was used to working with SQL developer, I installed 32 bit SQL developer in XP and tried connecting to my DB SID "XE". But the connection failed with error-ORA-12505 TNS listener doesn't currently know of SID given in connect descriptor. I was at sea as to how this problem occurred since it was working fine with the SQL utility and I had also created few Informatica mappings using the same. I did browse a lot on this stuff hither thither and applied the suggestions offered to me after pinging the status of "lsnrctl" on public forums but to no avail. However, this morning I tried creating a new connection again, and Voila, it worked with no issues. I am guessing after reading in few posts that sometimes listener listens before the DB connects or something(pardon me for my crude reference as I am a newbie here) but I suggest to just restart the machine and check again.
I had the same problem so to resolve this problem I first reconfigure my listener using netca
after that I deleted my old database which was ORCL by using dbca
and then i created the new database again using dbca
I have faced the same issue and solved by restart the OracleServiceXE service. Goto Services.msc and then verify the 'OracleServiceXE' service is UP and running
If you use Oracle Express Edition, you should have this url
jdbc:oracle:thin:@localhost:1521:xe or jdbc:oracle:thin:@localhost:1521/XE
I had similar problem with liquibase config plugin in pom.xml. And I changed my configuration:
`<configuration>
<driver>oracle.jdbc.OracleDriver</driver>
<url>jdbc:oracle:thin:@localhost:1521:xe</url>
<defaultSchemaName></defaultSchemaName>
<username>****</username>
<password>****</password>
</configuration>`
Check by doing tnsping and instance name in host machine. It will give u the tns decription and all most of the time host name is different which is not matching.
I resolve my issue likewise
In Unix machine $ tnsping (Enter)
It gives me full tns description where I found that host name is different.. :)
Please check both OracleServiceXE
and OracleXETNSListener
having the status started when you navigate through start->run->services.msc
.
For my case only OracleXETNSListener
was started but OracleServiceXE
was not started, when I started by right clicking -> start
and checked the connection its working for me
I fixed this issue by changing "SID" to "SERVICE_NAME" in my TNSNAMES.ora file.
Please see if your DB asks for SID or SERVICE_NAME.
Cheers
I had similar problem in SQL Workbench.
URL:
jdbc:oracle:thin:@111.111.111.111:1111:xe
doesn't work.
URL:
jdbc:oracle:thin:@111.111.111.111:1111:asdb
works.
This help me in my concrete situation. I afraid, that could exists many other reasons with different solutions.
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","scott","tiger");
Error I got:
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: localhost:1521:xe
How I solved it:
Connection con=DriverManager.getConnection("jdbc:oracle:thin:localhost:1521:xe","scott","tiger");
(Remove @)
Don't know why, but its working now...
Had a similar issue. The issue started occurring suddenly - we are having load balanced database connection URL, but in jdbc connections I was pointing to a single db directly.
Changed to load balanced db url and it worked.
In my case not was working out, finally i restarted my oracle and TNS listener and everything worked. Was struggling for 2 days.
I got this error ORA-12505, TNS:listener does not currently know of SID given in connect descriptor when I tried to connect to oracle DB using SQL developer.
The JDBC string used was jdbc:oracle:thin:@myserver:1521/XE, obviously the correct one and the two mandatory oracle services OracleServiceXE, OracleXETNSListener were up and running.
The way I solved this issue (In Windows 10)
1. Open run command.
2. Type services.msc
3. Find services with name OracleServiceXE and OracleXETNSListener in the list.
4. Restart OracleServiceXE service first. After completing the restart try restarting OracleXETNSListener service.
Apart from running services(OracleServiceXE,OracleXETNSListener) on there is a chance your Anti-virus software/firewall may still block them. Just make sure they are not blocked.
I just fixed it by restarting / starting oracleService in services
'Programing' 카테고리의 다른 글
std :: array를 사용하여 C 배열 초기화 "int arr [] = {e1, e2, e3,…}"동작을 에뮬레이트하는 방법? (0) | 2020.06.29 |
---|---|
비밀번호를 저장하라는 메시지를 브라우저에 표시하려면 어떻게해야합니까? (0) | 2020.06.29 |
C #을 사용한 압축 / 압축 해제 문자열 (0) | 2020.06.28 |
Xcode 4에서 탭 사이를 빠르게 전환하는 방법은 무엇입니까 (0) | 2020.06.28 |
bash의 문자열 비교. (0) | 2020.06.28 |