ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

The ORA-12505 error occurs when a client tries to connect to an Oracle database using a SID (system identifier) that the listener is unaware of. This can happen for several reasons:
  • The SID specified in the connect descriptor does not match any of the SIDs configured on the server.
  • The listener is not running or not configured to listen for the specified SID. 
  • The Oracle database service for the specified SID is not running.
To resolve this issue, you should check the following:
  1. Verify that the SID specified in the connect descriptor is correct and matches the SID of the target database.
  2. Check if the listener is running and configures to listen for the specified SID. You can do this by running the "lsnrctl status" command and checking if the specified SID is listed.
  3. Make sure that the Oracle database service for the specified SID is running.
  4. You can also check the listener.ora and tnsnames.ora files to ensure they are pointing to the correct SID and Service Name.
  5. If you are unsure of the SID of the target database, you can query the V$DATABASE view to determine the current SID:
    SELECT name FROM v$database;
  6. If the above steps do not resolve the issue, it's possible that the TNS Listener service is not running. Check the service status and start it if necessary.
  7. If the problem still persists, you can try to connect using the service name instead of SID; you can check your tnsnames.ora to know the service name and use it to connect.

    SQLPLUS username/password@service