ORA-12514, TNS:listener does not currently know of service requested in connect descriptor error occurs when the listener cannot find any matched service with the provided service name, preventing it from connecting to the database.The service name you used to connect to the database is either unavailable or incorrectly configured. Oracle Listener detects a mismatch between the service name you provided with connection descriptor configurations.The error ORA-12514, TNS:listener does not currently know of service requested in connect descriptor is thrown when oracle fails to establish connection due to invalid service name provided in the configuration.
The Oracle service may be starting; please wait a moment before attempting to connect a second time. Check the listener’s existing information of services by running: lsnrctl services. Check that the SERVICE NAME parameter in the connect descriptor of the net service name used specifies a service that the listener is familiar with. If a connect identifier was used, make sure the service name specified is one the listener recognises. Look for any events in the listener.log file to resolve the error ORA-12514, TNS:listener does not currently know of service requested in connect descriptor.
The Problem
When you attempt to connect to a database, you will be given the host name, port, user name, password, and service name or Sid. When Oracle starts up, it will listen for connections on the same host name and port. The SID is the name of the Oracle instance that is currently running. The service name is an alias for the instance that allows you to connect to it. If there is a mismatch in the service name configuration, you will be unable to connect to the running Oracle database instance. The error message ORA-12514, TNS:listener does not currently know of service requested in connect descriptor will be displayed.
Host name : localhost
port : 1521
service name : orcl
username : hr
password : hr
Error
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
(CONNECTION_ID=glCwDQzBSiScXNzmRhbuQg==)
Solution 1
The oracle server may be starting. wait for a moment and retry the connection. The network glitch may be occur. This will prevent to establish the connection to the oracle database. First make sure the database is running and no network issue with the database. If the host name is used to connect, try with IP address to connect with oracle database. Make sure the port configured is same and running port is the same. If you are using via application, the connection url should be configured as per the format.
jdbc:oracle:thin:@localhost:1521/servicename
Solution 2
Check the listen is running without any issue. If any issue in listen you can stop and start once. This will refresh the connection with the configured host and port. Listener might be hang due to multiple connections. Try connecting the listener once after restarting the listener. This will resolve the error ORA-12514, TNS:listener does not currently know of service requested in connect descriptor.
lsnrctl status
lsnrctl stop
lsnrctl start
Solution 3
Verify that the configured service name matches a valid service name in the Oracle database. The SQL query below will retrieve the configured service names from the Oracle database. If the provided service name in listener.ora differs from the database configuration, use the database’s service name. This will fix the error ORA-12514, TNS:listener does not currently know of service requested in connect descriptor.
select value from v$parameter where name='service_names'
value
------
orclcdb
Solution 4
Verify the listener.ora file. The configuration should look like this. The Oracle instance configuration will be stored in the SID LIST LISTENER. In the database, this configuration will map GLOBAL DBNAME, SID NAME, and ORACLE HOME. The SID NAME should be the same as the service name from the previous query. The PROTOCAL, HOST, and PORT are defined by the LISTENER configuration. The LISTENER configuration uses this configuration to wait for the database connection to establish.
/u01/app/oracle/product/version/db_1/network/admin/listener.ora
OR
[ORACLE_HOME]/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orclcdb)
(SID_NAME = orclcdb)
(ORACLE_HOME = /u01/app/oracle/product/version/db_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
)
)
#HOSTNAME by pluggable not working rstriction or configuration error.
DEFAULT_SERVICE_LISTENER = (orclcdb)
Solution 5
The tnsnames.ora file contains the service name configuration as well as the listener host and port. A sample tnsnames.ora file demonstrating service name configuration is provided below. In tnsnames.ora, check the service name. If the service name is not configured or if the configuration is incorrect, make the changes listed below.
/u01/app/oracle/product/version/db_1/network/admin/tnsnames.ora
OR
[ORACLE_HOME]/network/admin/tnsnames.ora
ORCLCDB=localhost:1521/orclcdb
ORCL=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
Solution 6
Check your system environment configuration for the oracle database. The oracle database configuration will show the right database which is running. If multiple oracle database versions are installed in the server, it may conflict with the oracle database versions. Then environment setting will be in ~/.bash_profile, ~/.bashrc OR /etc/..bashrc.
export ORACLE_UNQNAME=orclcdb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/version/db_1
export ORACLE_SID=orclcdb
export PATH=/home/oracle/bin:/home/oracle/LDLIB:$ORACLE_HOME/bin:/usr/sbin:$PATH
Solution 7
Finally verify the configuration you provided while you try to connect with the database. If you misspelt the configuration, the error will be shown. Check the below configuration as per your oracle database configurations.
Host name : localhost
port : 1521
service name : orcl
username : hr
password : hr
Are you getting an “ORA-12514: TNS:listener does not currently know or service requested in connect descriptor” error? Learn what causes it and how to resolve it in this error.
If you try to connect to an Oracle database, you may receive this error:
ORA-12514: TNS:listener does not currently know or service requested in connect descriptor
This error means that a listener on the Oracle database has received a request to establish a connection. However, the connection descriptor mentions a service name that has not been registered with the listener, or has not been configured for the listener.
ORA-12514 Solution
There are a few steps to resolve this error.
- Check the service names on the database (if possible)
- Update TNSNAMES.ORA to include the service name
Step 1: Check the service names on the database
The first step to resolve the ORA-12514 is to see which service names the database knows about.
If you’re able to connect to your database, run the following query:
SELECT value
FROM v$parameter
WHERE name = 'service_names';
| VALUE |
| XE |
This will show all of the service names your database knows about.
You’ll need to add these into the TNSNAMES.ORA file, which I’ll show you how to do shortly.
What if you can’t connect to your database? This is a valid question, seeing as you’re getting this error when you try to connect to the database.
You could use a different connection string.
Or, you could connect to the server and run sqlplus locally.
Or, you could ask a coworker or a DBA to run this command for you.
This all depends on how your environment is set up.
Alternative: check which service names are known by the listener
Another way of seeing which service names are available to the listener is by running the lsnrctl command
lsnrctl services
This will show you the names of the services, which you can check against your connect descriptor. It’s an alternative way to getting the service names if you can’t connect to the database as mentioned in the previous step.
Step 2: Update your TNSNAMES.ORA file
After you have the name of the service, open your TNSNAMES.ORA file.
This file is located here:
%ORACLE_HOME%NETWORKADMIN
ORACLE_HOME is where your Oracle database is installed on the server, or on your own computer if you’re using Oracle Express.
For example, in my installed version of Oracle Express, my ORACLE_HOME is:
C:oraclexeapporacleproduct11.2.0server
So, my TNSNAMES is located here:
C:oraclexeapporacleproduct11.2.0servernetworkadmin
Your TNSNAMES.ORA file has one or more entries in it that represent your databases. They are in the following format:
<addressname> = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = <hostname>)(Port = <port>)) ) (CONNECT_DATA = (SERVICE_NAME = <service_name>) ) )
The addressname is what you use in the connection string, and service_name is what the service is known as on the database (from step 1)
Now, update the TNSNAMES.ORA by either adding a new entry or modifying an existing entry. You need to make sure that there is an entry that has a service_name value that is equal to the value you found in step 1.
XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = Ben-PC)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) )
Once you have done this, you should be able to connect to your database in the method you wanted to that caused this error.
sqlplus [email protected]
This should now work.
So, that’s how you resolve the ORA-12514 error.
You can read my guide to the Oracle errors here to find out how to resolve all of the Oracle errors.
Lastly, if you enjoy the information and career advice I’ve been providing, sign up to my newsletter below to stay up-to-date on my articles. You’ll also receive a fantastic bonus. Thanks!
Problem
This technote describe a solution to resolve the Oracle error ORA-12514. The error appears when configuring the connection to a Oracle based IBM Rational RequisitePro project, the error comes up during the validation. When trying to connect to the Oracle database using an Oracle client, the same error message appears.
Symptom
The full error message is as follows:
[Microsoft][ODBC driver for Oracle][Oracle]ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
-Unable to connect to the database.
-Ensure that the configuration and account information are valid.
Cause
The fully qualified service name is not used.
Resolving The Problem
In the Oracle client, update the service name so that it uses the fully qualified service name as seen in the below example.
After updating the service name, test the connection using the Oracle client. The Oracle client should now be able to connect to the database, and the validation in RequisitePro should be successful as well.
Example:
TNSNAMES.ORA entry before change:
REQPRO =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = server.company.com)(PORT =
1521))
)
(CONNECT_DATA =
(SERVICE_NAME = REQPRO)
)
)
TNSNAMES.ORA entry after change:
REQPRO.COMPANY.COM =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = server.company.com)(PORT =
1521))
)
(CONNECT_DATA =
(SERVICE_NAME = REQPRO)
)
)
[{«Product»:{«code»:»SSSHCT»,»label»:»Rational RequisitePro»},»Business Unit»:{«code»:»BU053″,»label»:»Cloud & Data Platform»},»Component»:»Database: Oracle»,»Platform»:[{«code»:»PF033″,»label»:»Windows»}],»Version»:»7.0;7.0.0.1;7.0.0.2;7.0.0.3;7.0.0.4;7.0.0.5;7.0.0.6;7.0.0.7;7.0.1;7.0.1.1;7.0.1.2;7.0.1.3;7.0.1.4;7.0.1.5;7.0.1.6;7.1;7.1.0.1;7.1.0.2;7.1.0.3″,»Edition»:»»,»Line of Business»:{«code»:»LOB45″,»label»:»Automation»}}]
null
ORA-12514 при подключении к экземпляру Oracle
Причин по которым может возникнуть ошибка ORA-12514 много, я расскажу об одной из возможных с предисторией.
У нашего заказчика развернут Oracle 11.2 на Windows Server.
При предоставлении заказчиком учётных данных для подключения нас насторожил обязательный формат логина SQLplus с явным указанием идентификатора соединения (connect_identifier)
sqlplus sys/pass@connect_identifier as sysdba
В процессе проведения работ нам потребовалось запустить базу данных в NOMOUNT через shutdown immediate,
C:Windowssystem32>sqlplus sys/pass@connect_identifier as sysdba SQL*Plus: Release 11.2.0.1.0 Production on *** Copyright (c) 1982, 2010, Oracle. All rights reserved. Присоединен к: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> shutdown immediate База данных закрыта. База данных размонтирована. Экземпляр ORACLE завершен. SQL> startup nomount ORA-12514: TNS:прослушиватель в данный момент не имеет данных о службе, запрашиваемой в дескрипторе соединения
Коннекция без идентификатора соединения не удавалась(а именно она позволила бы поднять базу).
Решение
Проблема заключалась в некорректном значении системной переменной ORACLE_SID, значение которой не соответствовало названию экземпляра. В корректно настроенной системе переменная значение ORACLE_SID должно соответсвовать названию экземпляра отображенному в названии сервиса OracleService%sid_name%.
Изменение системной переменной решило описанную проблему.
Ошибка TNS-12514 может возникнуть во множестве случаев, как на windows, так и на unix/linux платформах. Но чаще всего неприятности с подключением происходят именно на windows платформе.
Первое, что необходимо проверить, настройки самого прослушивателя listener.ora:
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
ADR_BASE_LISTENER = C:apporacleproduct12.1.0dbhome_1
Далее следует убедиться, что экземпляр БД запущен.
> export ORACLE_SID=my_sid > sqlplus / as sysdba Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options SQL>
Если вместо версии БД мы получаем сообщение:
Connected to an idle instance. SQL>
то запускаем БД:
SQL>startup
Если подключиться к БД по-прежнему не удается, то проверяем процесс прослушивателя.
LSNRCTL for 64-bit Windows: Version 12.1.0.2.0 - Production on 14-DEC-2015 16:50:50 Copyright (c) 1991, 2014, 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 12.1.0.2.0 - Production Start Date 14-DEC-2015 16:37:40 Uptime 0 days 0 hr. 13 min. 10 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File C:apporacleproduct12.1.0dbhome_1listener.ora Listener Log File C:apporacleproduct12.1.0dbhome_1logdiagtnslsnrphoenixlisteneralertlog.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) The listener supports no services The command completed successfully
Обычно каждая БД регистрируется автоматически. Если появляется сообщение “прослушиватель не поддерживает сервисов”, то, как правило, экземпляр БД не может зарегистрироваться. При регистрации используются сетевые параметры, заданные по-умолчанию. Если они не совпадают с настройками прослушивателя, то в БД необходимо установить параметр LOCAL_LISTENER. По-умолчанию параметр имеет пустое значение.
SQL> show parameter local_listener;
NAME TYPE VALUE
------------------------------------ ----------- -------------------------------
local_listener string
SQL> alter system set LOCAL_LISTENER='(ADDRESS = (PROTOCOL=TCP)(HOST=localhost)(PORT=1521))' scope=both;
System altered.
SQL> show parameter local_listener;
NAME TYPE VALUE
------------------------------------ ----------- -------------------------------
local_listener string (ADDRESS = (PROTOCOL=TCP)(HOST=
=localhost)(PORT=1521))
SQL>
После установки параметра БД автоматически регистрируется для прослушивателя.