ORA-12505: TNS: listener doesn't know the SID
The connect string names a SID the listener doesn't know. Often a service name passed as a SID, especially in JDBC URLs with host:port:SID.
- Error code
ORA-12505- Category
- Connection and login
What it means
A connect descriptor can name an instance by SID or a database by SERVICE_NAME. ORA-12505 means it used a SID and the listener has no instance by that name. With multitenant databases, PDBs are reached by service name only, so a PDB name used as a SID fails this way.
Newer releases word it as Cannot connect to database. SID SID_value is not registered with the listener at host_port.
Common causes
- A JDBC URL in the
jdbc:oracle:thin:@host:port:NAMEform (SID) whereNAMEis really a service name. - Using a PDB name as a SID.
- The instance is down, so it isn't registered.
How to fix it
-
Connect by service name instead. In JDBC, use the slash form.
-- SID form (fails for a PDB): jdbc:oracle:thin:@db-host:1521:salespdb -- service name form: jdbc:oracle:thin:@//db-host:1521/salespdb
-
Check what the listener knows with
lsnrctl status, and that the instance is started.
Related errors
ORA-12514TNS: listener doesn't know the requested serviceORA-12541TNS: no listenerORA-01034ORACLE not available
More connection and login errors
ORA-01017invalid username/password; logon deniedORA-12154TNS: could not resolve the connect identifierORA-12170TNS: connect timeout occurredORA-03113end-of-file on communication channelORA-03135connection lost contactORA-28000the account is lockedORA-28001the password has expiredORA-27101shared memory realm does not exist
The code and message text are from the Oracle Database Error Help. Browse the full Oracle error list or search every database error.
Work on Oracle in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Oracle and the other databases you use.