ORA-12514 means the client reached a running listener, but the listener has no database service with the name in the connect string. Often the service name is wrong, for example the database name instead of the pluggable database's service, or the database has not registered with the listener yet. Oracle AI Database 26ai's message names the service and the listener's address.
Reproduce the Error
A test user is created for the examples:
Example:
-- a test user for the examples drop user if exists demo_app cascade; create user demo_app identified by "Demo_Pass_26" default tablespace users; grant create session to demo_app;
Connecting to service FREEPDB, which does not exist:
Example:
sqlplus -s -L demo_app/Demo_Pass_26@localhost:1521/FREEPDB <<'SQL' select user from dual; SQL
Output:
ERROR: ORA-12514: Cannot connect to database. Service FREEPDB is not registered with the listener at host 127.0.0.1 port 1521. (CONNECTION_ID=XSZ6qgsSofDgYwIAEaw58A==) SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
Fix: Use a Service the Listener Knows
Example:
# the services the listener knows lsnrctl status | grep "Service \"" sqlplus -s -L demo_app/Demo_Pass_26@localhost:1521/freepdb1 <<'SQL' select user from dual; SQL
Output:
Service "5621983b6dfb0909e0630b00580a528d" has 1 instance(s). Service "5c7765245c3602a0e063020011accee6" has 1 instance(s). Service "FREE" has 1 instance(s). Service "FREEXDB" has 1 instance(s). Service "formspdb" has 1 instance(s). Service "freepdb1" has 1 instance(s). USER ---------- DEMO_APP
The list shows freepdb1, the pluggable database's service; FREE is the container database root. Service names are not case-sensitive.
Other Causes
- The database was just started, or the listener restarted, and has not registered yet: wait a minute or run ALTER SYSTEM REGISTER.
- The connect string gives the instance name (SID) as the service name, while the services are named differently.
- The database registers with a different listener, on another port; check the LOCAL_LISTENER parameter.
Related Guides
- How to Fix ORA-12541: TNS No Listener in Oracle
- How to Fix ORA-12154: TNS Could Not Resolve the Connect Identifier in Oracle
Conclusion
ORA-12514 means the listener does not know the requested service. List its services with lsnrctl status, connect to the right one, usually the pluggable database's, and make sure the database is open and registered.
