The listener supports no services - oracle

I installed Oracle Database 11gR2 as well as Oracle Grid Infrastructure on a Linux box, then I created the orcl database.
I have always been able to connect to my database using SQL*Plus or OEM. But lately, I'm facing an issue when typing the command lsnrctl status, and so I'm not able to connect to the database.
My listener.ora file:
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = pc.company.com)(PORT = 1521))
)
)
ADR_BASE_LISTENER = /u01/app/oracle
My tnsnames.ora file :
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = pc.company.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.example.com)
)
)
When typing lsnrctl status, I get the following :
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-JUL-2014 03:35:48
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 21-JUL-2014 03:25:58
Uptime 0 days 0 hr. 9 min. 50 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/pc151/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=pc.company.com)(PORT=1521)))
The listener supports no services
The command completed successfully
When typing sqlplus / as sysdba then startup, I get this :
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+DATA/orcl/spfileorcl.ora'
ORA-17503: ksfdopn:2 Failed to open file +DATA/orcl/spfileorcl.ora
ORA-29701: unable to connect to Cluster Synchronization Service
And the srvctl start database command fails to start the database up too.
My oratab file is the following :
#Backup file is /u01/app/oracle/product/11.2.0/dbhome_1/srvm/admin/oratab.bak.pc150 line added by Agent
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
+ASM:/u01/app/oracle/product/11.2.0/grid:N
orcl:/u01/app/oracle/product/11.2.0/dbhome_1:N # line added by Agent

The database registers its service name(s) with the listener when it starts up. If it is unable to do so then it tries again periodically - so if the listener starts after the database then there can be a delay before the service is recognised.
If the database isn't running, though, nothing will have registered the service, so you shouldn't expect the listener to know about it - lsnrctl status or lsnrctl services won't report a service that isn't registered yet.
You can start the database up without the listener; from the Oracle account and with your ORACLE_HOME, ORACLE_SID and PATH set you can do:
sqlplus /nolog
Then from the SQL*Plus prompt:
connect / as sysdba
startup
Or through the Grid infrastructure, from the grid account, use the srvctl start database command:
srvctl start database -d db_unique_name [-o start_options] [-n node_name]
You might want to look at whether the database is set to auto-start in your oratab file, and depending on what you're using whether it should have started automatically. If you're expecting it to be running and it isn't, or you try to start it and it won't come up, then that's a whole different scenario - you'd need to look at the error messages, alert log, possibly trace files etc. to see exactly why it won't start, and if you can't figure it out, maybe ask on Database Adminsitrators rather than on Stack Overflow.
If the database can't see +DATA then ASM may not be running; you can see how to start that here; or using srvctl start asm. As the documentation says, make sure you do that from the grid home, not the database home.

for listener support no services you can use the following command to set local_listener paramter in your spfile use your listener port and server ip address
alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.101)(PORT=1520)))' sid='testdb' scope=spfile;

You need to add your ORACLE_HOME definition in your listener.ora file. Right now its not registered with any ORACLE_HOME.
Sample listener.ora
abc =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = abc.kma.com)(PORT = 1521))
)
)
SID_LIST_abc =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME= /abc/DbTier/11.2.0)
(SID_NAME = abc)
)
)

you need to reconfigure your tnsnames.ora so that it can point to your hostname
after that listener will be able to pick the new hostname. after which check the status of your listener lsnrctl status and start listener lsnrctl start
then register your listener. Alter system register

Check local_listener definition in your spfile or pfile. In my case, the problem was with pfile, I had moved the pfile from a similar environment and it had LISTENER_sid as LISTENER and not just LISTENER.

Related

ORA-12154 TNS can't resolve specified identifier

i'm trying to connect to my oracle server using a batch file, but while i try connecting i got the following error:
ORA-12154: TNS: could not resolve the connect identifier specified
I've already check the tnsnames.ora ad the identifier is spelled correctly; i've put in the environment's variable a new variable named TNS_ADMIN that point on my admin folder in the client section.
ty tnsname.ora is as following
ORCL_SRVDATIORIO12 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ORCL)
(SERVER = DEDICATED)
)
)
If i try connecting to that server using SSMA for example, using the tnsnames mode (SID or the description name), connection will establish just fine; while running it in command line it return me the error.
Also if i try running
tnsping <my tnsname>
i'll get:
TNS Ping Utility for 32-bit Windows: Version 12.2.0.1.0 - Production on 03-GEN-2019 14:36:59
Copyright (c) 1997, 2016, Oracle. All rights reserved.
File di parametri utilizzati:
C:\app\client\user\product\12.2.0\client_1\network\admin\sqlnet.ora
TNS-03505: Impossible finding name
So i checked the sqlnet.ora file and the directory path seems fine to me:
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, LDAP)
any suggestion?
EDIT: i solved by simply creating a new text file and copy past the previous contents in the new one.
you need to check tnsnames.ora. tnsnames.ora contains tns names and their connection declarations. You need to use appropriate tns name to connect your database.
tnsping <tns_name> //tns_name is needed to be defined in tnsnames.ora
in your case
tnsping ORCL_SRVDATIORIO12 10
need to return success message. if it does not, it means that your connection decriber is wrong. In which case, you need to talk with your DBA

Oracle SQL Developer: Failure - Test failed: The Network Adapter could not establish the connection?

Problem
Please note that I changed details for security purposes. However, the problem remains intact.
I installed an Oracle 11g database on a server at location, say, herp-devDV.derp.edu.
Now I have another Oracle 11g database on a server at location, say, derp-db.derp.edu.
I entered the connection name, username, password, hostname, and service name in Oracle SQL developer for both herp-devDV.derp.edu and derp-db.derp.edu. I can connect to schema in derp-db.derp.edu, but not herp-devDV.derp.edu. It gives me this message:
Failure - Test failed: The Network Adapter could not establish the connection
Details
I have the following information:
Port 1521 is not open for either server when I telnet
My listener is up and running for both.
I can access derp-db.derp.edu on Oracle SQL Developer.
Oracle client is on my local machine + Oracle SQL Developer
I can remote desktop to both servers
What I have done
Googled
Stackoverflow
Ran stop and start lnrctl commands
On herp-devDB.derp.edu I ran lsnrctl status
I received the following output
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 - Production
Start Date 03-JUN-2014 13:37:22
Uptime 6 days 0 hr. 53 min. 4 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File D:\oracle\product\11.2.0\dbhome_1\network\admin\listener.ora
Listener Log File d:\oracle\diag\tnslsnr\HERP-DEVDB\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=HERP-DEVDB.derp.edu)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "HERPDEVDBXDB" has 1 instance(s).
Instance "herpdevdb", status READY, has 1 handler(s) for this service...
Service "herpdevdb" has 1 instance(s).
Instance "herpdevdb", status READY, has 1 handler(s) for this service...
The command completed successfully
I then check out my listener.ora and find
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\oracle\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = HERP-DEVDB.derp.edu)(PORT = 1521))
)
)
At this point, I confess I am scratching my head as I don't see anything sticking out and telling me why this should not be working.
The only clue is when I check derp-db.derp.edu and run the command lsnrctl status. Please
see excerpt below:
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DERP-DB.edu)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.3.0 - Production
Start Date 18-MAY-2014 02:19:01
Uptime 22 days 12 hr. 23 min. 18 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
---etc----
So I am still scratching my head. Why would derp-db be connecting to the DERP-DB.edu but herp-devDB is connecting to EXTPROC1521? How do I fix this? The listener.ora and other files between these two servers are almost identical except for the name of the instances.
Hmmm.
EDIT1: I changed the listener.ora in herp. This didn't fix it.
EDIT2: I cannot telnet into derp-db.derp.edu on port 1521. But I can still connect to it with SQL Developer? Wth?
EDIT3 I cannot telnet into herp-devdb.derp.edu on port 1521 either.
EDIT4 I cannot ping IP addresses of either server.
Anyway assistance would be greatly appreciated. Thanks
Regards,
Geeky
I am answering this for the benefit of future community users. There were multiple issues. If you encounter this problem, I suggest you look for the following:
Make sure your tnsnames.ora is complete and has the databases you wish to connect to
Make sure you can tnsping the server you wish to connect to
On the server, make sure it will be open on the port you desire with the specific application you are using.
Once I did these three things, I solved my problem.
I had a similar issue where I also continuously got the same error. I tried many things like changing the listener port number, turning off the firewall etc. Finally I was able to resolve the issue by changing listener.ora file. I changed the following line:
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
to
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
I also added an entry in the /etc/hosts file.
you can use Oracle net manager to change the above line in listener.ora file. See Oracle Net Services Administrator's Guide for more information on how to do it using net manager.
Also you can use the service name (database_name.domain_name) instead of SID while making the connnection.
I Hope it helps.
I just had same issue when I installed the oracle 11g and then creating the database.
I don't even know that the listener has to create manually.
Hence, I open Net Configuration Assistant and manually create the listener.
And I can connect the database that I created locally through sql developer.
I solved this by writing the explicit IP address defined in the Listener.ora file as the hostname.
So, instead of "localhost", I wrote "192.168.1.2" as the "Hostname" in the SQL Developer field.
In the below picture I highlighted the input boxes that I've modified:
I solved just by: given correct host and port
so:
Open oracle net manager
Local
Listener
in Listener on address 2 then copy host to Oracle Developer
finally connect to oracle
You can locate a file named listener.ora under the installation folder oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
It contains the following entries
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = Codemaker-PC)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
You should verify the HOST (Here it is Codemaker-PC) should be the computer name. If it's not correct the change it as computer name.
then try the following command on the command prompt run as administrator,
lsnrctl start
Curiously, I was able to solve the same issue by doing the exact opposite move to svc's ! I had to :
1) replace the FQDN hostname in my tnsnames.ora / listener.ora files with localhost, and restart the listener service, and
2) two, I had to use "SYS as SYSDBA" as the username in the SQL Developer input textbox
to finally be able to have SQL Developer hook to my local instance.
only start listner then u can connect with database.
command run on editor:
lsnrctl start
its work fine.
I faced the same problem.
I had to turn off my firewall, then it worked.
You could also open the port:
http://windows.microsoft.com/en-in/windows/open-port-windows-firewall#1TC=windows-7
This worked for me. may help some one. Turn off firewall. on RHEL 7
systemctl stop firewalld
For me, the HOST was set differently in tnsnames.ora and listener.ora.
One was set to the full name of the computer and the other was set to IP address.
I synchronized them to the full name of the computer and it worked. Don't forget to restart the oracle services.
I still don't understand exactly why this caused problem because I think IP address and computer name are ultimately same in my understanding.

Oracle 10g: Issue with startup mount command (ORA-24324, ORA-01041)

I want to disable the archive logs in my oracle db. But when i shutdown and try to mount the database i am getting the following error.
C:\>sqlplus scott/tiger#ORCL as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Sep 18 10:44:17 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
SQL> startup mount
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn't exist
Can any one please help me in resolving this issue.
Edit1:- Listener.ora
# listener.ora Network Configuration File: E:\oracle\product\10.2.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = INHOS.dg.server.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
Not sure if this is root cause, but after shutdown and before startup, try exiting and re-entering SQL*Plus.
First edit:
Ok, so, two different problems. The "hostdef extension doesn't exist" error happens when you try to startup from the same SQL*Plus session you shutdown from. Solution is to exit and re-enter SQL*Plus between shutdown and startup.
The ORA-12514 "Listener does not currently know of service requested in connect descriptor" is due to trying to remotely start (your SQL*Plus connect string is scott/tiger#ORCL as sysdba which specifies #ORCL) the instance, and the listener is configured only for dynamic service registration. If your listener is configured only for dynamic service registration, then trying to remotely start the instance will give you an ORA-12514. It's a bit of a catch-22. The problem is, until the instance is started, it can't register with the listener. If it's not registered with the listener, you can't start it up. There are two possible solutions:
You could add a static listener configuration to the listener.ora file and bounce the listener.
You could directly login as the Oracle software owner, to the server that the database is installed on, and set ORACLE_HOME and ORACLE_SID, then connect as / as sysdba.
Hope that helps.
ORA-24324 can mean that the database simply has not been started, and so the resolution would be to
first start the database and listeners (if any)

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

We have an application running locally where we're experiencing the following error:
ORA-12514: TNS:listener does not currently know of service requested
in connect descriptor
I've tested the connection using TNSPing which resolved correctly and
I tried SQLPlus to try connecting, which failed with the same error as above. I used this syntax for SQLPlus:
sqlplus username/password#addressname[or host name]
We have verified that:
the TNS Listener on the server is running.
Oracle itself on the server is running.
We don't know of any changes that were made to this environment.
Anything else we can test?
I had this issue and the fix was to make sure in tnsnames.ora the SERVICE_NAME is a valid service name in your database. To find out valid service names, you can use the following query in oracle:
select value from v$parameter where name='service_names'
Once I updated tnsnames.ora to:
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = *<validhost>*)(PORT = *<validport>*))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = *<servicenamefromDB>*)
)
)
then I ran:
sqlplus user#TEST
Success!
The listener is basically telling you that whatever service_name you are using isn't a valid service according to the DB.
(*I was running sqlplus from Win7 client workstation to remote DB and blame the DBAs ;) *)
I know this is an old question, but still unanswered. It took me a day of research, but I found the simplest solution, at least in my case (Oracle 11.2 on Windows 2008 R2) and wanted to share.
The error, if looked at directly, indicates that the listener does not recognize the service name. But where does it keep service names? In %ORACLE_HOME%\NETWORK\ADMIN\listener.ora
The "SID_LIST" is just that, a list of SIDs and service names paired up in a format you can copy or lookup.
I added the problem Service Name, then in Windows "Services" control panel, I did a "Restart" on the Oracle listener service. Now all is well.
For example, your listener.ora file might initially look like:
# listener.ora Network Configuration File: C:\app\oracle_user\product\12.1.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:\app\oracle_user\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle_user\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
... And to make it recognize a service name of orcl, you might change it to:
# listener.ora Network Configuration File: C:\app\oracle_user\product\12.1.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:\app\oracle_user\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\oracle_user\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = C:\app\oracle_user\product\12.1.0\dbhome_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
In my circumstances the error was due to the fact the listener did not have the db's service registered. I solved this by registering the services. Example:
My descriptor in tnsnames.ora:
LOCALDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = LOCALDB)
)
)
So, I proceed to register the service in the listener.ora manually:
SID_LIST_LISTENER =
(SID_DESC =
(GLOBAL_DBNAME = LOCALDB)
(ORACLE_HOME = C:\Oracle\product\11.2.0\dbhome_1)
(SID_NAME = LOCALDB)
)
Finally, restart the listener by command:
> lsnrctl stop
> lsnrctl start
Done!
I had this issue at Windows server 2008 R2 and Oracle 11g
go to Net Manager > Listener > select database services form the combox > "Global Database Name" must be same as "SID" and "Oracle Home Directory" must be correct.
If you don't have any entry for database services, create one and set correct global database , sid and oracle home.
This really should be a comment to [Brad Rippe][1]'s answer, but alas, not enough rep. That answer got me 90% of the way there. In my case, the installation and configuration of the databases put entries in the tnsnames.ora file for the databases I was running. First, I was able to connect to the database by setting the environment variables (Windows):
set ORACLE_SID=mydatabase
set ORACLE_HOME=C:\Oracle\product\11.2.0\dbhome_1
and then connecting using
sqlplus / as sysdba
Next, running the command from Brad Rippe's answer:
select value from v$parameter where name='service_names';
showed that the names didn't match exactly. The entries as created using Oracle's Database Configuration Assistant were originally:
MYDATABASE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = mylaptop.mydomain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mydatabase.mydomain.com)
)
)
The service name from the query was just mydatabase rather than mydatabase.mydomain.com. I edited the tnsnames.ora file to just the base name without the domain portion so they looked like this:
MYDATABASE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = mylaptop.mydomain.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = mydatabase)
)
)
I restarted the TNS Listener service (I often use lsnrctl stop and lsnrctl start from an administrator command window [or Windows Powershell] instead of the Services control panel, but both work.) After that, I was able to connect.
[1]: https://stackoverflow.com/users/979521/brad-rippe
Starting the OracleServiceXXX from the services.msc worked for me in Windows.
For thoses Who are using spring-boot and jdbc for connection.
You have to be careful while writing jdbcUrl in application.properties
With SID in Database connection -
source.datasource.jdbcUrl = jdbc:oracle:thin:#[HOST][:PORT]:SID
With Service name in db connection
globe.datasource.jdbcUrl = jdbc:oracle:thin:#//[HOST][:PORT]/SERVICE
This worked for me :)
For Dbeaver users: try selecting "SID" instead of "Service name" in connection settings.
I had the same problem. For me, just writing
sqlplus myusername/mypassword#localhost
did the trick, doing so makes it connect to the default service name, I guess.
This error can occur when an application makes a new connection for every database interaction or the connections are not closed properly. One of the free tools to monitor and confirm this is Oracle Sql developer (although this is not the only tool you can use to monitor DB sessions).
you can download the tool from oracle site Sql Developer
here is a screenshot of how to monitor you sessions. (if you see many sessions piling up for your application user during when you see the ORA-12514 error then it's a good indication that you may have connection pool problem).
Check to see the database is up. Log onto the server, set the ORACLE_SID environment variable to your database SID, and run SQL*Plus as a local connection.
I resolved this issue in my linux enviroment updating the IP of my machine in /etc/hosts file.
You can verify your network IP (inet end.) with:
$ifconfig
See if your IP matches with /etc/hosts file:
$cat /etc/hosts
Edit your /etc/hosts file, if nedded:
$sudo gedit /etc/hosts
Bye.
what worked for me was really simple, I just needed to initiate the service manually in the "Windows Services" (services.msc in cmd trompt).
my service name is: OracleServiceXXXXX.
I had also faced the same problem and spent 3 days to dig it out.
This happens because of your wrong TNS service entry.
First check whether you are able to connect to standby database from primary database using sql > sqlplus sys#orastand as sysdba (orastand is a standby database).
If you are not able to connect then it is a problem with the service. Correct the entry of service name in TNS file at primary end.
Check standby database the same way. Make the changes here too if required.
Make sure the log_archive_dest_2 parameter has the correct service name.
For those that may be running Oracle in a VM (like me) I saw this issue because my VM was running out of memory, which seems to have prevented OracleDB from starting up/running correctly. Increasing my VM memory and restarting fixed the issue.
Lots of answers here, but here comes a working example with code that you can copy and paste and test immediately:
For me the error 12514 was solved after specifying the correct SERVICE_NAME.
You find that on the server in the file tnsnames.ora which comes with 3 predefined service names (one of them is "XE").
I installed the Oracle Express database OracleXE112 which already comes with some preinstalled demo tables.
When you start the installer you are asked for a password. I entered "xxx" as password. (not used in production)
My server runs on the machine 192.168.1.158
On the server you must explicitely allow access for the process TNSLSNR.exe in the Windows Firewall. This process listens on port 1521.
OPTION A: For C# (.NET2 or .NET4) you can download ODAC11, from which you have to add Oracle.DataAccess.dll to your project. Additionally this DLL depends on: OraOps11w.dll, oci.dll, oraociei11.dll (130MB!), msvcr80.dll.
These DLLs must be in the same directory as the EXE or you must specify the DLL path in: HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\ODP.NET\4.112.4.0\DllPath. On 64 bit machines write additionally to HKLM\SOFTWARE\Wow6432Node\Oracle\...
OPTION B: If you have downloaded ODAC12 you need Oracle.DataAccess.dll, OraOps12w.dll, oci.dll, oraociei12.dll (160MB!), oraons.dll, msvcr100.dll. The Registry path is HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\ODP.NET\4.121.2.0\DllPath
OPTION C: If you don't want huge DLL's of more than 100 MB you should download ODP.NET_Managed12.x.x.x.xxxxx.zip in which you find Oracle.ManagedDataAccess.dll which is only 4 MB and is a pure managed DLL which works in 32 bit and 64 bit processes as well and depends on no other DLL and does not require any registry entries.
The following C# code works for me without any configuration on the server side (just the default installation):
using Oracle.DataAccess.Client;
or
using Oracle.ManagedDataAccess.Client;
....
string oradb = "Data Source=(DESCRIPTION="
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.158)(PORT=1521)))"
+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE)));"
+ "User Id=SYSTEM;Password=xxx;";
using (OracleConnection conn = new OracleConnection(oradb))
{
conn.Open();
using (OracleCommand cmd = new OracleCommand())
{
cmd.Connection = conn;
cmd.CommandText = "select TABLESPACE_NAME from DBA_DATA_FILES";
using (OracleDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
{
listBox.Items.Add(dr["TABLESPACE_NAME"]);
}
}
}
}
If the SERVICE_NAME=XE is wrong you get error 12514. The SERVICE_NAME is optional. You can also leave it away.
In my case the database had ran out of disk space. Which caused it to not respond. Once I cleared up that issue everything worked again.
I got the same error because the remote SID specified was wrong:
> sqlplus $DATASOURCE_USERNAME/$DATASOURCE_PASSWORD#$DB_SERVER_URL/$REMOTE_SID
I queried the system database:
select * from global_name;
and found my remote SID ("XE").
Then I could connect without any problem.
In my case, round brackets around the SERVICE_NAME was missing in the tnsnames.ora file.
<DBNAME> =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL=TCP)(HOST = nupark-cnvr-ora )(PORT=1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = <DBNAME> ***CLOSING ROUND BRACKET WAS MISSING HERE***
)
)
LISTENER_<DBNAME> =
(ADDRESS = (PROTOCOL = TCP)(HOST = nupark-cnvr-ora)(PORT = 1521))
I had just to replace my connection string
from:
jdbc:oracle:thin:#localhost:1521:xe
To:
jdbc:oracle:thin:#localhost:1521:orcl
For me this was caused by using a dynamic ipadress using installation. I reinstalled Oracle using a static ipadress and then everything was fine
Restarting the VM worked for me
My issue was resolved by replacing the'SID' in URL with 'service name' and correct host.
tnslsnr is up but database is down.
For oracle novice it is not obvious that database may be down while connections are accepted.
I had to start up database manually like that
su - oracle
export ORACLE_SID=XE
sqlplus sys as sysdba
And then in sql console
startup
In my case i failed to startup but got another error message and found the source of a problem - i had to change host name and then database auto startup was functional again.
I have implemented below workaround to resolve this issue.
I have set the ORACLE_HOME using command prompt
(right click cmd.exe and Run as System administrator).
Used below command
set oracle_home="path to the oracle home"
Go to All programs --> Oracle -ora home1 --> Configuration migration tools --> Net Manager --> Listener
Select Database Services from dropdown.
Both Global database name and SID are set to the same (ORCL in my case).
Set Oracle Home Directory.
Oracle Net Manager window example from oracle documentation:
Click on File and save network configuration.
The problem was that my connection string url contained database name instead of SID.
Replacing database name with oracle database connection SID solved this problem.
To know your oracle SID's you can browse tnsnames.ora file.
XE was the actual SID, so this is how my tomcat connection string looks like now:
<Resource
name="jdbc/my_db_conn"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:#//127.0.0.1:1521/XE"
username="test_user"
password="test" />
My server version was "Oracle 11.2 Express", but solution should work on other versions too.
I had a case that I used DBMS where I had to fulfill a db connection form.
I put SID into the Database field and in the dropdown, next to the field, I had had 'Service Name' value instead of 'SID' value.
(normally I don't use Oracle database so I've not been aware of the difference)
That was the reason I got the error message.
The problem can be in the incorrect URL.
For example, I'm using Oracle database (inside VM) with Spring framework and having this issue.
I had in my application.properties file:
spring.datasource.url=jdbc:oracle:thin:#//localhost:1521/orcl12c
But the db version was defferent:
spring.datasource.url=jdbc:oracle:thin:#//localhost:1521/orclcdb
The correct URL can be found in the tnsnames.ora file (this file would be available where the Oracle server, so if you using VM, you should look for this file inside your host VM).
For example for Oracle in the VirtualBox the command to see this file is:
nano /u01/app/oracle/product/version/db_1/network/admin/tnsnames.ora
In my case for Linux environment, the oracle file at ORACLE_HOME/bin was highlighted in "Red" color with different permissions as below:
I changed the permissions of this file as below:
1) Stop Oracle -> sudo systemctl stop oracle.service
2) Change the permission of oracle file at ORACLE_HOME/bin directory as "sudo chmod 777 oracle"
3) Start Oracle -> sudo systemctl start oracle.service
Then after this change, I checked the status of listener using lsnrctl status.Here, I can see the db instances loaded successfully.
However, I can connect using sqldeveloper only, with sqlplus command line I'm getting ORA-12547: TNS Lost Contact error. So, this can a quick workaround to use sqldeveloper.
Note: Take a backup of oracle file before changing the permissions.

ORA-12154: TNS:could not resolve the connect identifier specified

I am trying to connect to oracle 11g installed on Linux EL 5 and and getting the following error
SQL> connect sys/password#ud06 as sysdba
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
my listener.ora under network/admin is as follows
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=ud06)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=orcl)
(ORACLE_HOME=/home/oracle/app/oracle/product/11g)
(SID_NAME=orcl))
(SID_DESC=
(SID_NAME=plsextproc)
(ORACLE_HOME=/home/oracle/app/oracle/product/11g)
(PROGRAM=extproc)))
MY tnsnames.ora is as follows
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(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)
)
)
UD06=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ud06)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
MY lsnrctl status shows as follows:
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ud06.us.server.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 17-FEB-2010 16:23:06
Uptime 0 days 0 hr. 12 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11g/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/product/11g/log/diag/tnslsnr/ud06/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ud06.us.server.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "plsextproc" has 1 instance(s).
Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
The answer to this problem is very simple. Do not worry about the .ora files or any other configuration. Oracle does all these just perfect.
Only while connecting via command line, it gets confused with passwords that have a # symbol in them.
Therefore while connecting through command line SQL, do not use a password with a '#' in it. Just use the web interface to create an account having a password without an '#' symbol in it.
That is!! Problem solved. I had been breaking my head for quite a few days, and now my problem is solved!!
Can you ping ud06 successfully (as ud06, not ud06.us.server.com)?
What does the command
lsnrctl services
show?
EDIT:
It sounds to me like maybe the database instance name isn't actually "orcl"? What the lsnrctl services output tells me is that the "orcl" service, although defined in the listener.ora file, is not actually running.
Can you log on with a direct connection on the server? If so, what do you use as the ORACLE_SID environment variable value? Log in as the SYS user and issue the command:
ALTER SYSTEM REGISTER;
Then issue the lsnrctl services command again and see if an additional instance doesn't show up.
Also, as Alex points out, the tnsping command is reporting a fully qualified service name. Edit the sqlnet.ora file and set the NAMES.DEFAULT_DOMAIN value to NULL if it has a value.
EDIT 2: Does tnsping ud06 on the server work? Or is my assumption that client and server are on different systems wrong?
The SERVICE_NAME in the tnsping output doesn't match the entry in tnsnames.ora; is that file from the Windows box or the Linux box? It looks like you don't have a local (Windows) tnsnames.ora entry for u06 and it's guessing what the service name should be expanding it - I think that's what the reference to the hostname adapter means.
I also run into ORA-12154: TNS:could not resolve the connect identifier specified, and adding the user trying to connect to the oinstall group of oracle fixed it.
first try whether the oracle instance is started :
for windows:
start->configuration panel-> administration touls->Services->ORACLESERVICEORCL(my instance by the way)->start
Provide the connection string like this:
ServerName:port/ServiceName;User Name;Password
I was also facing the same error, try this code:
SQL> conn hr/hr #pdborcl;
and if you find same error, it means that you have a different pluggable database name.
Check the pluggable database name by just writing the following command in sqlplus
sql> SELECT name, con_id FROM v$pdbs;
I fixed this problem using this steps.
First of all, this error occured , if you didn't install same directory or drive.
But the answer is here.
Login windows as a Adminstrator.
Go to Control Panel.
System Properties and click Enviroment
Find the OS variable and change name as a "TNS_ADMIN"
And change the value as a "tnsnames's directory address"
Restart the system.
Congrulations.

Resources