Why am I getting "cx_Oracle.DatabaseError: ORA-12541: TNS:no listener" error when I try to connect to oracle database from vscode? - oracle

I have a script I wrote to connect to my local oracle database. It worked perfectly before now. I was able to connect and populate the database with data from vscode. After I formatted my machine and reinstalled oracle database and instance client. I couldn't connect again, whenever I try, I get this error
Traceback (most recent call last):
File "c:\Users\ChiNedu\Documents\python\Oracle\oracle.py", line 10, in <module>
cnx = cx_Oracle.connect(conStr)
cx_Oracle.DatabaseError: ORA-12541: TNS:no listener
PS C:\Users\ChiNedu\Documents\python\Oracle>
when I type lsnrctl stat in command prompt, I get this
LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 09-FEB-2023 17:33:46
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DESKTOP-QPAJR53)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
64-bit Windows Error: 1001: Unknown error
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 2: No such file or directory
I tried to change the HOST NAME but can't find the %ORACLE_HOME%/network/admin directory from my machine services. Please help me get this fixed. Thanks.

Related

Unable to connect to DB from Oracle SQL Developer

I am trying to configure a database in Oracle SQL Developer, database is Oracle 21c. Upon initial troubleshooting it seems to be an issue with the listeners. Below are some more details that will help for troubleshooting.
When I try to check status of listener in cmd (admin mode), I get below error:
C:\Windows\System32>lsnrctl status
LSNRCTL for 64-bit Windows: Version 21.0.0.0.0 - Production on 18-NOV-2022 20:24:49
Copyright (c) 1991, 2021, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.207)(PORT=1521)))
TNS-12535: TNS:operation timed out
TNS-12560: TNS:protocol adapter error
TNS-00505: Operation timed out
64-bit Windows Error: 60: Unknown error
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 2: No such file or directory
and when I try to start listener, I get below error :
C:\Windows\System32>lsnrctl start
LSNRCTL for 64-bit Windows: Version 21.0.0.0.0 - Production on 18-NOV-2022 20:26:01
Copyright (c) 1991, 2021, Oracle. All rights reserved.
Starting tnslsnr: please wait...
TNSLSNR for 64-bit Windows: Version 21.0.0.0.0 - Production
System parameter file is C:\app\patil\product\21c\homes\OraDB21Home1\network\admin\listener.ora
Log messages written to C:\app\patil\product\21c\diag\tnslsnr\Nisarg\listener\alert\log.xml
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.207)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
TNS-12560: TNS:protocol adapter error
TNS-00515: Connect failed because target host or object does not exist
64-bit Windows Error: 49: Unknown error
Listener failed to start. See the error message(s) above...
Below is the error we get when we try to connect from Oracle SQL Developer :
There is no problem with the service, screenshot below :
Below thing also helps to confirm that there is no issue with the DB :
Microsoft Windows [Version 10.0.22621.819]
(c) Microsoft Corporation. All rights reserved.
C:\Users\patil>sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Fri Nov 18 20:37:34 2022
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0
SQL> select name, open_mode from v$pdbs;
NAME
--------------------------------------------------------------------------------
OPEN_MODE
----------
PDB$SEED
READ ONLY
XEPDB1
READ WRITE
SQL>

Security Update for Windows preventing Oracle Listener from running?

For the last month I have installed and used Oracle 11 XE, but this morning I restarted my computer and installed new updates from Windows. Now I cannot get the database to work. I know this caused it because I was using SQL Developer right up until I restarted. I get this error when attempting to run in SQL Developer
An error was encountered performing the requested operation:
IO Error: The Network Adapter could not establish the connection
Vendor code 17002
I went to Service and made sure my OracleServiceXE was running, which it was. I tried starting "OracleXETNSListener" and got this message:
The OracleXETNSListener service on Local Computer started and then stopped.
Some services stop automatically if they are not in use by other services and programs.
I then went to CMD and typed "lsnrctl status" and got:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<host name>)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 61: Unknown error
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
64-bit Windows Error: 2: No such file or directory
Now at this point, almost everything I googled told me to start the listener and if that doesn't work run as admin. I did both of those things, but it didn't work.
running normally in cmd:
Starting tnslsnr: please wait...
Unable to OpenSCManager: err=5
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error
running as admin:
Starting tnslsnr: please wait...
(note: it stalls for 2 minutes)
TNS-12560: TNS:protocol adapter error
To complicate matters, my computer told me "We couldn't finish installing updates" and that makes me hesitant to uninstall the updates.

can't start Oracle Database

I just install Oracle, but can't start it. i get error below:
root#coding:/u01/binaries# $ORACLE_HOME/bin/lsnrctl start
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 15-NOV-2015 15:57:30
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12.1.0/dbhome_2/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/coding/listener/alert/log.xml
Error listening on: (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use
Listener failed to start. See the error message(s) above...
Looks like something is already using port 1521
Try a netstat -a | grep 1521
And look what process is using this port
Johan

Oracle 11gR2 on Aix listner will not start

I have created a new Oracle instance on the Aix server. Database is running fine, but my listener would not start. I got the following errors in the listener log:
<msg time='2012-09-26T17:33:17.304-07:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='xxxxx111'
host_addr='000.00.0.111'>
<txt>TNS-12546: TNS:permission denied
TNS-12560: TNS:protocol adapter error
TNS-00516: Permission denied
IBM/AIX RISC System/6000 Error: 2: No such file or directory
</txt>
</msg>
When I tried to start the listener, i got the following error:
lsnrctl start
LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production on 26-SEP-2012 17:38:17
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /oracle/QI1/112_64/bin/tnslsnr: please wait...
TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
System parameter file is /oracle/QI1/112_64/network/admin/listener.ora
Log messages written to /oracle/QI1/saptrace/diag/tnslsnr/xxxxxx/listener/alert/log.xml
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxxxxx.na.xxxxx.com)(PORT=1521)))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
IBM/AIX RISC System/6000 Error: 67: Address already in use
Listener failed to start. See the error message(s) above...
Any help would be greatly appreciated!
Following #dave's answer, I checked the sqlnet.ora file, and the error was in the parameter:
TCP.VALIDNODE_CHECKING = YES
After commenting out the line, the listener starts
#TCP.VALIDNODE_CHECKING = YES
I found that the ip address SQLnet file was incorrect. After fixing the ip address,the listener was able to start.

Oracle TNS: No Listener error while tnsping for my service

I just Installed Oracle 11g on windows 7 64bit, and when I tried to ping using tnsping I faced this error TNS-12541: TNS:no listener.
So, I tried to start the listener using LSNRCTL> start also I faced this error:
TNS-12560: TNS:protocol adapter error
TNS-00530: Protocol adapter error
Set ORACLE_HOME and try starting the Listener again.

Resources