Creating an oracle database connection with Talend Open Studio - oracle

I want to create a database connection with talend open studio. I have installed oracle 10g and sqlplus environnement.
When I have tried creating a connection, I get this error:
java.lang.RuntimeException: 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 org.talend.core.model.metadata.builder.database.JDBCDriverLoader.getConnection(JDBCDriverLoader.java:164)
at org.talend.core.model.metadata.builder.database.ExtractMetaDataUtils.connect(ExtractMetaDataUtils.java:1049)
at org.talend.core.model.metadata.builder.database.ExtractMetaDataFromDataBase.testConnection(ExtractMetaDataFromDataBase.java:311)
at org.talend.repository.ui.utils.ManagerConnection.check(ManagerConnection.java:266)
at org.talend.repository.ui.wizards.metadata.connection.database.DatabaseForm.checkConnection(DatabaseForm.java:2294)
at org.talend.repository.ui.wizards.metadata.connection.database.DatabaseForm.access$45(DatabaseForm.java:2217)
at org.talend.repository.ui.wizards.metadata.connection.database.DatabaseForm$26.widgetSelected(DatabaseForm.java:2549)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
....
Here is my login and password:
this is the tnsnames.ora's content
# tnsnames.ora Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = user)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)

Related

Oracle 18c XE: Connecting to a PDB using SID (for legacy application)

I just installed the Oracle 18c XE Dadtabase and created a PDB (XEPDB1) inside the CDB. I then created a new schema inside the PDF and I can connect to that schema successfully using the Service Name (SQL Developer).
But my legacy application requires a SID connection, which seems to be allowed using the USE_SID_AS_SERVICE_XE = on line in listener.ora. I also added the SID_DESC to the SID_LIST, but I still get the error:
TNS:listener does not currently know of SID given in connect descriptor
This is my listener.ora:
DEFAULT_SERVICE_LISTENER = XE
USE_SID_AS_SERVICE_XE = on
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\michael\product\18.0.0\dbhomeXE)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\michael\product\18.0.0\dbhomeXE\bin\oraclr18.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = XE
(ORACLE_HOME = C:\app\michael\product\18.0.0\dbhomeXE)
(SID_NAME = XEPDB1
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = persik.ddns.vmware.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
And this is the tnsnames.ora:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
XEPDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XEPDB1)
)
)
LISTENER_XE =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
It is supposed to be USE_SID_AS_SERVICE_LISTENER_NAME refer section 7.4.19 in your case listener name is LISTENER
i.e USE_SID_AS_SERVICE_LISTENER
Test case with Java code and 18xe docker container.
Commented out line in listener.ora and running java code
[oracle#240946cde855 admin]$ cat listener.ora | grep on
# listener.ora Network Configuration File:
#USE_SID_AS_SERVICE_LISTENER=on
$grep "1521" Conn.java
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:#192.168.99.128:1521:xepdb1", "hr", "hr");
$ java -cp "ojdbc8.jar" Conn
Exception in thread "main" 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
Uncommenting and bouncing listener
[oracle#240946cde855 admin]$ sed -i 's|#USE|USE|g' listener.ora
[oracle#240946cde855 admin]$ cat listener.ora | grep on
# listener.ora Network Configuration File:
USE_SID_AS_SERVICE_LISTENER=on
[oracle#240946cde855 admin]$ lsnrctl reload
LSNRCTL for Linux: Version 18.0.0.0.0 - Production on 22-JUL-2020 10:39:52
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
$ java -cp "ojdbc8.jar" Conn
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production

Oracle Database 12c Connection

I have already set up an Oracle Database but I am facing a connectivity problem in the below manner:
sqlplus CISADM/CISADM#<IP>:1521/PSRM
sqlplus CISADM#PSRM
With the above two options I successfully connect to the database. Although, when I try to connect as:
sqlplus CISADM#<IP>:1521/PSRM
I get the following error :
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
I can perform ping either with IP, or hostname, tnsping with IP and hostname successfully.
My tnsnames.ora file:
PSRM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PSRM)
)
)
My sqlnet.ora file:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
I am connecting from client PC to a Database which is located in a VM. The above files are from client
Files from VM, where Database is hosted:
tnsnames.ora:
PSRM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PSRM)
)
)
listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP>)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
Any ideas?
You should run it like this :
sqlplus CISADM#\"<IP>:1521/PSRM\"
Important: The \" in the beginning and end of the server:port/service is part of the syntax.

Status : Failure -Test failed: Listener refused the connection with error: ORA-12514, TNS:listener does not currently know of service requested

I am getting this error while connecting to oracle 12c from SQL Developer,
Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
My tnsnames.ora file contents is:
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
) )
ORCL1 = (DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.1.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl.abc.com)
) )
ORCL = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = INT.abc.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.abc.com)
) )
My listener.ora file contents is:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\oracle\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER = (DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = INT.abc.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
) )
I am using Service Name as 'orcl1' and Host Name as '10.10.1.10' in sql developer "Add Connection" window and getting the above error.
I am able to connect to sqlplus using cmd with proper username and password.
Any help will be appreciated.
I was able to connect to SQL Developer, once i changed my Service Name to "orcl.abc.com"
It seems like you are connecting through sqlplus using orcl. check your hostname. In tnsnames.ora you are using int. abc.cm and in listener you are using ipaddress. Try to keep both same. Change hostname in tnsnames.ora to ipaddress.

TNS-12514: TNS:listener does not currently know of service requested in connect descriptor 4/2016

I am getting this error when trying to connect to freshly installed Oracle Enterprise from either SQL Developer or Net Manager. I did try every solution that I could find with no luck.
I am trying to connect with a system account and I am able to log in with sqlplus, so I know that my credentials are correct.
listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\Oracle\OracleUser\product\12.1.0\dbhome_2\bin\oraclr12.dll")
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\Oracle\OracleUser\product\12.1.0\dbhome_2)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\Oracle\OracleUser\product\12.1.0\dbhome_2\log
tnsnames.ora
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
error inside the ...\product\12.1.0\dbhome_2\log\diag\tnslsnr\iper410a\listener\trace\listener.log
24-APR-2016 19:10:33 * (CONNECT_DATA=(CID=(PROGRAM=null)(HOST=__jdbc__)(USER=null))(SERVICE_NAME=orcl)) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1195)) * establish * orcl * 12514
TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
24-APR-2016 19:10:40 * (CONNECT_DATA=(CID=(PROGRAM=SQL Developer)(HOST=__jdbc__)(USER=my_windows_login))(SERVICE_NAME=orcl)) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1198)) * establish * orcl * 12514
TNS-12514: TNS:listener does not currently know of service requested in connect descriptor
It confuses me that instead of 'system' Oracle account, the error is listing my windows login account (my_windows_login).
Please advise!
It seems you have two oracle homes.
Check the output of cmd -> tnsping orcl command. You can see which oracle directory is being used.
Then you can check Environment Variables -> System Variable -> Path and reorder Oracle Home directories. This worked in my case.

Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

I had my database working for over a year since yesterday. Out of sudden, I am no longer able to connect.
Error I am getting is:
Status : Failure -Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
Oracle 11.2
Windows 7
Both db and the listener are up and running. Port 1521 is opened.
C:\Apps\Oracle\product\11.2.0\dbhome_1\BIN>netstat -a -n -o| findstr "1521"
TCP 127.0.0.1:1521 0.0.0.0:0 LISTENING 2412
trying to log in via sqlplus
C:\depot\SBApp\main>sqlplus sbdba0/sbdba0#SBDB
SQL*Plus: Release 11.2.0.2.0 Production on Thu Dec 3 10:04:29 2015
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Error:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Listener.ora
# listener.ora Network Configuration File: C:\Apps\Oracle\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 = C:\Apps\Oracle\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\Apps\Oracle\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 = C:\Apps\Oracle\product
tnsnames.ora
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
###################################################################################################
#SBDB
SBDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = SBDB)
)
)
ifile=C:\Apps\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames_QA.ora
ifile=C:\Apps\Oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\tnsnames_PROD.ora
I am out of ideas, any help will be appreciated.
solved,
had to replace localhost from *.ora files with my PC hostname.

Resources