ORA-12545 : Oracle SID Suddenly Stopped working - oracle

I have a baffling problem. I have an Oracle 11g set up on Linux that was working fine. I was able to connect remotely from other machines using a SID based connection string such as
sqlplus myschema#192.168.184.102:1521:orcl
then for some inexplicable reason it stopped working. I'm not sure what I or someone else jiggled loose.
now i'm only able to connect remotely using a SERVICE_NAME or TNSNAME based methods
sqlplus myschema#192.168.184.102:1521/orcl
sqlplus myschema#ORCL
Both work and this would be fine and well, but I have applications that rely on SID connection pattern that I can change. Could some kind soul help me figure out what I'm missing
Below is my configuration:
LISTENER.ORA:
[oracle#dbora112 ~]$ cat /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = dbora112)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /opt/u01/app/oracle
LISTENER STATUS:
[oracle#dbora112 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 04-MAR-2015 14:50:05
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 04-MAR-2015 14:37:12
Uptime 0 days 0 hr. 12 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /opt/u01/app/oracle/diag/tnslsnr/dbora112/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbora112)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
TNSNAMES.ORA:
[oracle#dbora112 ~]$ cat /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.184.102)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
)
)
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.184.102)(PORT = 1521))
SQLNET:
[oracle#dbora112 ~]$ cat /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
# sqlnet.ora Network Configuration File: /opt/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
ADR_BASE = /opt/u01/app/oracle
Can connect with not problem using TNS
[oracle#dbora112 ~]$ sqlplus schema/xxx#ORCL
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 4 14:54:10 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
Can connect with no problem using Service Name
[oracle#dbora112 ~]$ sqlplus schema/xxx#192.168.184.102/ORCL
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 4 14:55:52 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
Cannnot connect with SID
[oracle#dbora112 ~]$ sqlplus schema/xxx#192.168.184.102:orcl
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 4 14:56:38 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12545: Connect failed because target host or object does not exist
Database Instance (SID)
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
orcl

Since you can connect with your TNS alias, and that is using the SID in the connection description, the SID is working.
But your EasyConnect string is incorrect. From the SQL*Plus documentation:
The easy or abbreviated connection identifier has the syntax:
[//]host[:port][/service_name]
You cannot use the SID with Easy Connect, only the service name; so your connect using:
sqlplus schema/xxx#192.168.184.102:orcl
or even
sqlplus schema/xxx#192.168.184.102:1521:orcl
... can never have worked. You can use that form with a JDBC URL using the older style:
jdbc:oracle:thin:#192.168.184.102:1521:orcl
... but that is not the same thing as an SQL*Plus connection, despite looking similar.
If you're trying to check if a JDBC connection of that form will work, you cannot do so with SQL*Plus, but your TNS alias check is verifying it is set up as you expect anyway - as long as it uses the same host, port and SID. It would probably be better to use the newer JDBC syntax, but from the question it sounds like you can't change that.
Read more about Easy Connect.

This could be when Oracle cannot resolve the hostname to IP. Can you resolve your hostname with nslookup? I.e.,
nslookup yourhostname
Also make sure reverse lookup is working:
nslookup yourIpAddr

Related

Oracle Personal Edition 21c: Listener cannot find service name

I'm getting started with Oracle Personal Edition. Installation was successful. Trying to connect to the database and getting stuck. I have:
tnsping xe2
TNS Ping Utility for 64-bit Windows: Version 21.0.0.0.0 - Production on 16-APR-2022 17:14:25
Copyright (c) 1997, 2021, Oracle. All rights reserved.
Used parameter files:
C:\app\geral\product\21c\homes\OraDB21Home1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = host.docker.internal)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XEPDB1)))
OK (10 msec)
which seems promising. In sqlplus I can:
sqlplus / as sysdba
SQL*Plus: Release 21.0.0.0.0 - Production on Sat Apr 16 17:14:40 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
then show the pdbs:
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 XEPDB1 READ WRITE NO
SQL>
So, I now want to try to connect to the CON_NAME XEPDB1 using that TNS entry I tested:
SQL> conn foo#xe2
Enter password:
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
Warning: You are no longer connected to ORACLE.
At this point, I'm stuck. How do I troubleshoot and resolve the cause of the error message?
Your listener is on and working but your instance has not dynamically registered it’s services with it nor are they statically part of your listener config.
Easiest option is to get your instance to register itself. Look at the instance parameter local_listener, this needs to point to your listener running on (HOST = host.docker.internal)(PORT = 1521), you can do this with a tnsname that points to the same listener or you can take advantage of EZConnect syntax and just use the host name (the default port is 1521 anyway). I would recommend setting up a tnsnames entry just called listener which contains the host and port but no connect_data.
(Using EZconnect)
Alter system set local_listener='host.docker.internal';
This will self-validate .
You then just need to wait for automatic registration to occur, you can see this happening in your listener logs, you can trigger it manually with alter system register; and you can confirm it’s happened by looking at the results of lsnrctl status host.docker.internal.

How to connect to oracle from SQL Developer

I have problem with connecting to Oracle from Sql developer. When I try this connection settings. it returns error from printscreen:
when I tried tns ping, it returns to me
C:\Windows\system32>tnsping XE
TNS Ping Utility for 64-bit Windows: Version 18.0.0.0.0 - Production on 09-APR-2021 23:47:25
Copyright (c) 1997, 2018, Oracle. All rights reserved.
Used parameter files:
C:\app\Uzivatel\product\18.0.0\dbhomeXE\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
OK (0 msec)
Can someone give me a point what I doing wrong? Thanks for help.
l
snrctl status is C:\Windows\system32> lsnrctl status
LSNRCTL for 64-bit Windows: Version 18.0.0.0.0 - Production on 09-APR-2021 23:57:42
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 18.0.0.0.0 - Production
Start Date 09-APR-2021 23:09:50
Uptime 0 days 0 hr. 47 min. 52 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\app\Uzivatel\product\18.0.0\dbhomeXE\network\admin\listener.ora
Listener Log File C:\app\Uzivatel\product\18.0.0\diag\tnslsnr\PoŔÝtaŔ\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
When I tryed to change to Sid, it returns me:
when I try to
C:\Windows\system32>lsnrctl reload
LSNRCTL for 64-bit Windows: Version 18.0.0.0.0 - Production on 10-APR-2021 00:10:54
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
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
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
The command completed successfully
But problem is still same:
I tried lsnrctl status and It return to me
C:\Users\Uzivatel>lsnrctl status
LSNRCTL for 64-bit Windows: Version 18.0.0.0.0 - Production on 10-APR-2021 02:01:20
Copyright (c) 1991, 2018, 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 18.0.0.0.0 - Production
Start Date 10-APR-2021 00:44:34
Uptime 0 days 1 hr. 16 min. 45 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\app\Uzivatel\product\18.0.0\dbhomeXE\network\admin\listener.ora
Listener Log File C:\app\Uzivatel\product\18.0.0\diag\tnslsnr\PoŔÝtaŔ\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=PoŔÝtaŔ)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "xe", status BLOCKED, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
Instance "XE", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
it seems that there is some problem, isnt it?
UPDATE
I wrongly supposed your Database was running.
Start your database by issuing a startup
CMD> sqlplus /as sysdba
SQL> startup
Before attempting to connect, check your listener with lsnrctl status you should now see the XE service there.
If everything's in place, you should then be able to connect.
As far as I can see, there's no service named XE
You can either connect by selecting SID instead of SERVICE NAME
Or try to add a static registration to your listener.ora
LISTENER =
(DESCRIPTION_LIST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
  )
)
SID_LIST_LISTENER=
(SID_LIST =
   (SID_DESC=
     (SID_NAME=XE)
     (SERVICE_NAME=XE)
     (ORACLE_HOME=C:\app\Uzivatel\product\18.0.0\dbhomeXE)
   )
)
Reload the listener
lsnrctl reload
And then try to connect via SQL Developer, using the SERVICE NAME
Another thing you can try, is getting inside the Database and issue a
alter system register;
To see if the database register against the listener by itself.
Are you sure that "XE" is your services name??
Try selecting SID and set a name to the connection

Can not connect to the Oracle Service

I would like to connect to the running "orcl" Oracle database.
I don't have much experience on the Oracle administrator. I installed Oracle 12c in a Windows Server, as I see the "Oracle", "OracleOraDB12Home1TNSListener" and "OracleServiceORCL" services are started in the machine.
I added the following to the "tnsnames.ora" file:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
I get "Ok" result from executing the "tnsping orcl" command.
I can login with "sqlplus / as sysdba" and when I query with "select name from v$database" command, I see "orcl" database is active.
But when I try to connect to the "orcl" database using Sqldeveloper, or when I execute
"sqlplus -L "system/password#(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = orcl)))"
I hit the issue below:
SQL*Plus: Release 12.2.0.1.0 Production on Thu Aug 1 10:53:28 2019
Copyright (c) 1982, 2016, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
When executing the "lsnrctl status" command:
LSNRCTL for 64-bit Windows: Version 12.2.0.1.0 - Production on 01-AUG-2019 12:16
:04
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1539)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 12.2.0.1.0 - Produ
ction
Start Date 01-AUG-2019 09:38:59
Uptime 0 days 2 hr. 37 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\app\Administrator\virtual\product\12.2.0\dbhome_1\n
etwork\admin\listener.ora
Listener Log File C:\app\Administrator\virtual\diag\tnslsnr\WIN-91FKK175
962\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=WIN-91FKK175962)(PORT=1539)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521_1ipc)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
How can I connect to the orcl database? What I am missing in configuration or anywhere?
i think what you want is just
sqlplus [user]/[Password]#[connect identifier]
eg. your user is system, Password is pswd and connect identifier in your example is 'ORCL'
so your sqlplus command would be:
sqlplus system/pswd#orcl
if you DB is installed on your local machine that it should be also be possible just to conect to localhost instead of service
sqlplus system/pswd#localhost

Oracle SQL Developer Works SQLplus DOESN'T

With Oracle SQL-Developer I'm able to connect to my VMware CentOS 7 Oracle database ORCL.
if I try to connect with SQLPlus I'm told the realm doesn't exist.
Any idea as to why I can connect with Oracle SQL-Developer and not SQLPlus on the same machine?
TNSPing resolves the SID/Service name without any problems.
C:\oracle\ora11g\11.2.0.2\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host = 192.168.1.50) (Port = 1521))) (CONNECT_DATA = (SERVICE_NAME = ORCL)))
OK (10 msec)
Here's the output from the SQLPlus connection attempt from the same machine that SQL-Developer is working without any issues.
C:\oracle\ora11g\11.2.0.2\BIN>sqlplus system/password#orcl
SQL*Plus: Release 11.2.0.2.0 Production on Wed Jul 3 08:31:13 2019
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3640
Additional information: -2140813497
Process ID: 0
Session ID: 0 Serial number: 0
Your sqlplus command, try this:
sqlplus user/password#192.168.1.50:1521/ORCL
In SQL Developer, once you're connected, run this:
show tns
show connection
Make sure you're actually trying to connect to the same database in SQLPlus, also make sure your $ORACLE_HOME and $ORACLE_SID are properly configured.
This looks like something is wrong with Oracle_Home or your listener.
Could you please - - LSNRCTL and check the status of the same.
If it is fine, then try to connect to sys:
sqlplus /nolog
conn / as sysdba

ORA-12514 TNS:listener does not currently know of service requested in connect descriptor for existing service

I know that this is a pretty popular problem, and I had run into it several times before but were able to resolve it but not this time.
I had made sure that I'm using the correct service name by running
SQL> select value from v$parameter where name='service_names';
VALUE
--------------------------------------------------------------------------------
XE
My tnsnames.ora has the XE service name:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
When I start the listener, it appear to recognize the service:
[root#aa-axm admin]# lsnrctl start
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 09-OCT-2015 12:58:28
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/xe/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/aa-axm/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)) (SERVICE_NAME=XE))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(SERVICE_NAME=XE))
Connecting to (DESCRIPTION=(SERVICE_NAME=XE)(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 09-OCT-2015 12:58:28
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/aa-axm/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE))(SERVICE_NAME=XE))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(SERVICE_NAME=XE))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
And yet, I'm still getting that blasted error
[root#aa-axm admin]# sqlplus SYSTEM/**********#XE
SQL*Plus: Release 11.2.0.2.0 Production on Fri Oct 9 12:58:36 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
What am I missing? TIA
I had it finally resolved by doing
alter system set local_listener='XE' scope=both;
alter system register;
thanks to Alex Poole for setting me on the right path.

Resources