Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback, please email oracle-forums_moderators_us@oracle.com

django.db.utils.DatabaseError: ORA-12541: TNS:no listener

Tony007Jul 12 2021 — edited Aug 21 2021

hi am trying to connect to my database am geting this error my database is up and listner

python manage.py runserver

Watching for file changes with StatReloader

Performing system checks...

System check identified no issues (0 silenced).

Exception in thread django-main-thread:

Traceback (most recent call last):

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection

self.connect()

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner

return func(*args, **kwargs)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 200, in connect

self.connection = self.get_new_connection(conn_params)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner

return func(*args, **kwargs)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/backends/oracle/base.py", line 233, in get_new_connection

**conn_params,

cx_Oracle.DatabaseError: ORA-12541: TNS:no listener

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner

self.run()

File "/usr/lib/python3.6/threading.py", line 864, in run

self._target(*self._args, **self._kwargs)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/utils/autoreload.py", line 64, in wrapper

fn(*args, **kwargs)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 121, in inner_run

self.check_migrations()

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/core/management/base.py", line 486, in check_migrations

executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 18, in __init__

self.loader = MigrationLoader(self.connection)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 53, in __init__

self.build_graph()

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/migrations/loader.py", line 220, in build_graph

self.applied_migrations = recorder.applied_migrations()

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 77, in applied_migrations

if self.has_table():

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 55, in has_table

with self.connection.cursor() as cursor:

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner

return func(*args, **kwargs)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 259, in cursor

return self._cursor()

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 235, in _cursor

self.ensure_connection()

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner

return func(*args, **kwargs)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection

self.connect()

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/utils.py", line 90, in __exit__

raise dj_exc_value.with_traceback(traceback) from exc_value

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection

self.connect()

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner

return func(*args, **kwargs)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/backends/base/base.py", line 200, in connect

self.connection = self.get_new_connection(conn_params)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/utils/asyncio.py", line 26, in inner

return func(*args, **kwargs)

File "/home/django/Documents/pythonreact/ReactProj/django-backend/.venv/lib/python3.6/site-packages/django/db/backends/oracle/base.py", line 233, in get_new_connection

**conn_params,

django.db.utils.DatabaseError: ORA-12541: TNS:no listener

my server listner

status

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=199.777.7.111)(PORT=1539)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production

Start Date 09-JUL-2021 07:04:29

Uptime 2 days 1 hr. 2 min. 29 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u1/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora

Listener Log File /u1/app/oracle/product/19.0.0/dbhome_1/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=199.777.7.111)(PORT=1539)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=hostname)(PORT=5500))(Security=(my_wallet_directory=/u1/app/oracle/admin/dbname/xdb_wallet))(Presentation=HTTP)(Session=RAW))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=8081))(Presentation=HTTP)(Session=RAW))

Services Summary...

Service "dbname" has 2 instance(s).

Instance "dbname", status UNKNOWN, has 1 handler(s) for this service...

Instance "dbname", status READY, has 1 handler(s) for this service...

Service "ncsalphaXDB" has 1 instance(s).

Instance "dbname", status READY, has 1 handler(s) for this service...

The command completed successfully

LSNRCTL> status

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=199.777.7.111)(PORT=1539)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production

Start Date 09-JUL-2021 07:04:29

Uptime 2 days 1 hr. 2 min. 56 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u1/app/oracle/product/19.0.0/dbhome_1/network/admin/listener.ora

Listener Log File /u1/app/oracle/product/19.0.0/dbhome_1/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=199.777.7.111)(PORT=1539)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=hostname)(PORT=5500))(Security=(my_wallet_directory=/u1/app/oracle/admin/dbname/xdb_wallet))(Presentation=HTTP)(Session=RAW))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=8081))(Presentation=HTTP)(Session=RAW))

Services Summary...

Service "dbname" has 2 instance(s).

Instance "dbname", status UNKNOWN, has 1 handler(s) for this service...

Instance "dbname", status READY, has 1 handler(s) for this service...

Service "dbnameXDB" has 1 instance(s).

Instance "dbname", status READY, has 1 handler(s) for this service...

The command completed successfully

LSNRCTL> service

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=199.777.7.111)(PORT=1539)))

Services Summary...

Service "dbname" has 2 instance(s).

Instance "dbname", status UNKNOWN, has 1 handler(s) for this service...

Handler(s):

"DEDICATED" established:0 refused:0

LOCAL SERVER

Instance "dbname", status READY, has 1 handler(s) for this service...

Handler(s):

"DEDICATED" established:275 refused:0 state:ready

LOCAL SERVER

Service "ncsalphaXDB" has 1 instance(s).

Instance "dbname", status READY, has 1 handler(s) for this service...

Handler(s):

"D000" established:0 refused:0 current:0 max:1022 state:ready

DISPATCHER <machine: hostname, pid: 2679>

(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(PORT=25278))

The command completed successfully

LSNRCTL> !

NL-00853: undefined command "!". Try "help"

LSNRCTL> exit

[oracle@hostname ~]$ cat /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

199.777.7.111 hostname

Comments
Post Details
Added on Jul 12 2021
5 comments
1,795 views