ORA-12521: TNS Listener Does Not Currently Know of Instance Requested in Connect Descriptor
ORA-12521 is a common Oracle networking error that occurs when the TNS listener receives a connection request but cannot find the specified instance name in its registry. This typically means the database instance is either not running, not properly registered with the listener, or the instance name in the client's connection descriptor is incorrect. It is frequently encountered in both single-instance and RAC environments.
Top 3 Causes and SQL Examples
Cause 1: Database Instance Is Down or Not Fully Open
The most frequent cause is that the Oracle instance has not been started or has crashed unexpectedly. The listener registers instances only when they are in OPEN state via the PMON background process.
-- Check current instance status
SELECT INSTANCE_NAME, STATUS, DATABASE_STATUS
FROM V$INSTANCE;
-- If instance is in MOUNTED state, open it
ALTER DATABASE OPEN;
-- If instance is completely down, start it from SQL*Plus as SYSDBA
STARTUP;
Cause 2: Instance Not Registered with the Listener
Oracle uses PMON for dynamic listener registration. If dynamic registration fails or the instance was started before the listener, the listener won't know about it.
-- Force immediate re-registration with the listener
ALTER SYSTEM REGISTER;
-- Verify active services registered with the listener
SELECT NAME, ENABLED
FROM V$ACTIVE_SERVICES
ORDER BY NAME;
-- Check all database services
SELECT NAME, NETWORK_NAME
FROM DBA_SERVICES;
Run ALTER SYSTEM REGISTER; immediately after this — it forces PMON to push instance information to the listener within seconds.
Cause 3: Incorrect INSTANCE_NAME or SERVICE_NAME in Connection String
A typo or case mismatch in tnsnames.ora will cause ORA-12521 even when the database is running perfectly.
-- Get the correct instance name and service names from the DB
SELECT INSTANCE_NAME, SERVICE_NAMES
FROM V$INSTANCE;
-- Cross-check with the parameter setting
SELECT VALUE
FROM V$PARAMETER
WHERE NAME = 'service_names';
Compare the output with your tnsnames.ora:
MYDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbserver01)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = MYSERVICE) -- Must match V$INSTANCE.SERVICE_NAMES exactly
)
)
Quick Fix Solutions
-
Restart the instance if it is down:
STARTUP;from SQL*Plus as SYSDBA. -
Force listener re-registration: Run
ALTER SYSTEM REGISTER;from inside the database. -
Restart the listener: Use
lsnrctl stopfollowed bylsnrctl startfrom the OS. -
Add static registration in
listener.oraas a fallback if dynamic registration is unreliable, then restart the listener.
-- After applying fixes, confirm service is visible
SELECT NAME, INST_ID, ENABLED
FROM GV$ACTIVE_SERVICES
ORDER BY INST_ID, NAME;
Prevention Tips
-
Automate registration monitoring: Schedule a job using
DBMS_SCHEDULERto runSELECT NAME FROM V$ACTIVE_SERVICESevery 5 minutes and alert the DBA if no services are found. -
Version-control your network config files: Keep
listener.ora,tnsnames.ora, andsqlnet.oraunder source control (e.g., Git). After every DB migration, patch, or clone operation, validate that service names in the files match what the database actually reports viaV$INSTANCE.
Related Errors
| Error Code | Description |
|---|---|
| ORA-12514 | Listener does not know of service name in connect descriptor |
| ORA-12505 | Listener does not know of SID in connect descriptor |
| ORA-01034 | ORACLE not available (instance is down) |
| ORA-12541 | No listener (listener process itself is not running) |
📖 Want a more detailed guide?
Check out the full in-depth version (Korean) on oraerror.com — includes detailed analysis, additional SQL examples, and prevention tips.
Top comments (0)