// Oracle error reference

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
Error message
TNS:listener does not currently know of SID given in connect descriptor

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:NAME form (SID) where NAME is really a service name.
  • Using a PDB name as a SID.
  • The instance is down, so it isn't registered.

How to fix it

  1. 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
  2. Check what the listener knows with lsnrctl status, and that the instance is started.

Related errors

More connection and login errors

The code and message text are from the Oracle Database Error Help. Browse the full Oracle error list or search every database error.

// fewer errors, faster fixes

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.