DB/RDBMS

ORA-12505 TNS listener does not currently know of SID given in connect descriptor 해결하기

호형 2020. 4. 28. 10:00

datasource intializing 과정에서 

[18:17:46.353][ERROR][com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException:line595] - HikariPool-1 - Exception during pool initialization. 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:489) ~[ojdbc6-1.0.0.jar:11.2.0.4.0] at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553) ~[ojdbc6-1.0.0.jar:11.2.0.4.0] at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:254) ~[ojdbc6-1.0.0.jar:11.2.0.4.0] at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) ~[ojdbc6-1.0.0.jar:11.2.0.4.0] at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528) ~[ojdbc6-1.0.0.jar:11.2.0.4.0] at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.1.jar:na] at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:353) ~[HikariCP-3.4.1.jar:na]

....

와 같은 오류가 발생하는 경우가 있을수 있다. 

나같은 경우는 datasource url을 작성을 할 때 service name을 사용해야 했는데 SID를 사용하는  문법을 사용해서였다. 

상황에 따라서 다음과 같이 : 혹은 / 로 구분해서 datasource url을 작성해야 한다. 

SID              : jdbc:oracle:thin:@[ip]:[port]:[sid]
service name : jdbc:oracle:thin:@[ip]:[port]/[service name]