0
votes

I tried to connect my Netbeans Java project to Oracle Database but it showed the error ORA:12505 TNS:listener does not currently know of SID given in connect descriptor Even when I used SQL Developer to connect, I received the same error.

Does anyone know how to fix it? Thank you in advance.

NOTE: I use command SQLPlus in CMD and it work fine. My listener is not resting.

UPDATE: Here is my listener.ora file context:

SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = C:\Oracle) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:C:\Oracle\bin\oraclr19.dll") ) )

LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) )

and here is the result of lsnrctl status

LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 13-MAY-2021 18:36:25

Copyright (c) 1991, 2019, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production Start Date 13-MAY-2021 17:28:29 Uptime 0 days 1 hr. 7 min. 56 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File C:\Oracle\network\admin\listener.ora Listener Log File
C:\Oracle\base\diag\tnslsnr\DESKTOP-A10GTQJ\listener\alert\log.xml Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=DESKTOP-A10GTQJ)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\.\pipe\EXTPROC1521ipc))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=DESKTOP-A10GTQJ)(PORT=5500))(Security=(my_wallet_directory=C:\ORACLE\BASE\admin\system\xdb_wallet))(Presentation=HTTP)(Session=RAW)) Services Summary... Service "48f123709e024effbc4514551f7222c6" has 1 instance(s). Instance "system", status READY, has 1 handler(s) for this service... Service "52448234712340b69f274bcc790ecfe0" has 1 instance(s). Instance "system", status READY, has 1 handler(s) for this service... Service "CLRExtProc" has 1 instance(s). Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "orclpdb" has 1 instance(s). Instance "system", status READY, has 1 handler(s) for this service... Service "system" has 1 instance(s). Instance "system", status READY, has 1 handler(s) for this service... Service "systemXDB" has 1 instance(s). Instance "system", status READY, has 1 handler(s) for this service... The command completed successfully

2
You will need to post an example of the connect strings involved, the content of your listener.ora file, and the output of lsnrctl status.pmdba
Thanks, I uptated the question,.llgx 10
It is better to add the actual text to your question, rather than links to images.pmdba
As a side observation, it appears that you have named your container database 'SYSTEM'. Not a very good choice. First, names really should convey some meaning, and SYSTEM doesn't really do that. Second, SYSTEM is also the name of one of the default accounts within the database and while there is no techinical conflict, it will make discussion and communication rather error prone. When naming the container, why not just go with the default of CDB?EdStevens

2 Answers

0
votes

Btw, you can enable USE_SID_AS_SERVICE_listener_name. In this case you can connect to your service even if you specifying your service name in SID.

0
votes

CLRExtProc is not the SID of the database. It is an extension that allows Oracle to communicate with external .Net libraries. If you are trying to connect to the pluggable database I see listed, then you must use service_name, not SID, for that database. Your connection string would then look like this:

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

Note: In a container / pluggable database architecture, SID only ever points to the container database, which should never be used to hold application objects. In general it is better to use service_name whenever possible.

See here for additional JDBC connection string formats: https://www.oracle.com/a/tech/docs/java-programming-with-oracle-database-19c.pdf