Skip to content

ORA-12505: TNS Listener Does Not Know of SID - Fix Oracle Connection Error

ORA-12505: TNS Listener Does Not Currently Know of SID Given in Connect Descriptor

Section titled “ORA-12505: TNS Listener Does Not Currently Know of SID Given in Connect Descriptor”

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

This error occurs when the Oracle listener receives a connection request for a SID (System Identifier) that it doesn’t recognize or that isn’t currently registered with it. This is a common connectivity issue that typically indicates service registration problems.

  • Automatic Registration: Oracle instances automatically register with listeners on startup
  • Manual Registration: Services can be statically configured in listener.ora
  • Dynamic Registration: Services register themselves using the PMON background process
  • SID: Legacy connection method using System Identifier
  • Service Name: Modern preferred method using service names
  • Compatibility: Both should work when properly configured
  • Database not started or not fully mounted
  • Instance name doesn’t match SID in connect descriptor
  • Database registered with different SID than expected
  • Instance failed to register with listener
  • Listener not running or recently restarted
  • Listener.ora missing static service definition
  • Wrong listener port or address
  • Multiple listeners causing confusion
  • Connection attempt during database startup
  • Network connectivity problems
  • TNS configuration mismatches
  • Service registration delay after restart
-- Check if database is running and mounted
SELECT status FROM v$instance;
-- Check database name and SID
SELECT name, db_unique_name FROM v$database;
SELECT instance_name FROM v$instance;
Terminal window
# Check listener status
lsnrctl status [listener_name]
# Check services registered with listener
lsnrctl services [listener_name]
# Show listener configuration
lsnrctl show trc_level
Terminal window
# Test TNS resolution
tnsping <connect_identifier>
# Check tnsnames.ora content
cat $ORACLE_HOME/network/admin/tnsnames.ora
-- View registered services
SELECT name, pdb FROM v$services;
-- Check listener registration
SELECT * FROM v$listener_network;
Terminal window
# Check if Oracle processes are running
ps -ef | grep oracle
# Start database if not running
sqlplus / as sysdba
SQL> startup;
Terminal window
# Stop listener
lsnrctl stop [listener_name]
# Start listener
lsnrctl start [listener_name]
# Check status
lsnrctl status [listener_name]
-- Connect as SYSDBA and force registration
sqlplus / as sysdba
SQL> alter system register;

Solution 4: Use Service Name Instead of SID

Section titled “Solution 4: Use Service Name Instead of SID”

Update your connection string to use SERVICE_NAME instead of SID:

# Instead of:
mydb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = server)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ORCL)
)
)
# Use:
mydb =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = server)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl.domain.com)
)
)

Solution 5: Add Static Service to Listener.ora

Section titled “Solution 5: Add Static Service to Listener.ora”
# Add to listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl.domain.com)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = ORCL)
)
)
Terminal window
# List all Oracle homes
cat /etc/oratab
# Check which ORACLE_HOME is being used
echo $ORACLE_HOME
which sqlplus
Terminal window
# Test TCP connectivity to listener port
telnet <hostname> 1521
# Check if listener is binding to correct interface
netstat -an | grep 1521
Terminal window
# Check database alert log
tail -f $ORACLE_BASE/diag/rdbms/<db_name>/<instance_name>/trace/alert_<instance_name>.log
# Check listener log
tail -f $ORACLE_BASE/diag/tnslsnr/<hostname>/<listener_name>/trace/<listener_name>.log
  • Always start listener before database
  • Allow time for service registration after startup
  • Monitor startup processes for errors
  • Use SERVICE_NAME instead of SID for new connections
  • Maintain consistent naming conventions
  • Document all service configurations
  • Regular listener status checks
  • Monitor service registration timing
  • Keep listener and database logs clean
  • Standardize ORACLE_HOME settings
  • Use proper TNS_ADMIN configurations
  • Maintain consistent tnsnames.ora files
  • ORA-12154: TNS could not resolve connect identifier
  • ORA-12514: TNS listener does not know of service
  • ORA-12541: TNS no listener
  • ORA-12560: TNS protocol adapter error
  1. Check database status: SELECT status FROM v$instance;
  2. Restart listener: lsnrctl stop; lsnrctl start
  3. Force registration: ALTER SYSTEM REGISTER;
  4. Verify services: lsnrctl services
Terminal window
# Essential diagnostic commands
lsnrctl status
lsnrctl services
tnsping <service_name>
ps -ef | grep pmon
  • $ORACLE_HOME/network/admin/tnsnames.ora
  • $ORACLE_HOME/network/admin/listener.ora
  • $ORACLE_HOME/network/admin/sqlnet.ora
  • /etc/oratab