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

对着背影说爱祢 提交于 2019-11-29 14:24:55

If you know your oracle database SID, then use

jdbc:oracle:thin:@localhost:1521:orcl

otherwise use below in case you have service name

jdbc:oracle:thin:@localhost:1521/orcl

Also, make sure service name with the name ORCL should be up and running. If still doesn't work, then you need to restart your machine and try again above.

Still, not working ? Then, try following :

Login with SYSTEM user and register LOCAL_LISTENER by running below SQLs.

alter system set local_listener = '(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))' scope = both;
alter system register;

How to check oracle SID and service name :

SELECT sys_context('USERENV', 'SID') FROM DUAL; -- It will return your oracle database SID

SELECT sys_context('USERENV', 'SERVICE_NAME') FROM DUAL; -- It will return your oracle database service name

If you want to know the default SID of your database use this query in sqlplus:

SELECT sys_context('USERENV', 'SID') FROM DUAL;

Use this value in the JDBC URL instead of "orcl".

Nirmala

Can you use the below URL?
Note the difference, this is to use the SERVICENAME instead of a SID.

jdbc:oracle:thin:@localhost:1521/orclservice
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!