ORA-12516, TNS:listener could not find available handler
Categories:
Resolving ORA-12516: TNS:listener could not find available handler

This article provides a comprehensive guide to understanding and resolving the ORA-12516 error, a common issue encountered when connecting to Oracle databases, particularly in high-load or misconfigured environments.
The ORA-12516 error, "TNS:listener could not find available handler for the requested type of connection," is a frequent stumbling block for developers and administrators working with Oracle databases. It typically indicates that the Oracle Listener is unable to establish a connection to a database instance, often due to resource limitations or incorrect configuration. This guide will delve into the root causes of this error and provide practical solutions to help you diagnose and resolve it effectively.
Understanding the Oracle Listener and ORA-12516
The Oracle Listener is a separate process that runs on the database server. Its primary role is to listen for incoming client connection requests and hand them off to the appropriate database instance. When a client (like a Java application using JDBC) attempts to connect, it first contacts the listener. The listener then checks if it can find a suitable 'handler' â a server process or dispatcher â to manage the client's session. The ORA-12516 error occurs when the listener cannot find such a handler, often because all available server processes are busy, or the configuration limits have been reached.
flowchart TD A[Client Application] --> B[Oracle Listener] B --> C{Available Handler?} C -- Yes --> D[Database Instance (Server Process)] C -- No --> E[ORA-12516 Error] D --> F[Connection Established] E --> G[Connection Failed]
Flowchart illustrating the Oracle connection process and ORA-12516 trigger.
Common Causes and Solutions
The ORA-12516 error can stem from several issues, primarily related to resource management within the Oracle database. Addressing these often involves adjusting database parameters or listener configurations.
listener.ora
, tnsnames.ora
, init.ora
or SPFILE) and consider testing changes in a development environment first.1. Insufficient Process/Session Limits
One of the most common reasons for ORA-12516 is that the database has reached its maximum allowed processes or sessions. Each client connection consumes a session, and each session requires a process. If these limits are too low, new connections will be rejected.
SHOW PARAMETER PROCESSES;
SHOW PARAMETER SESSIONS;
Checking current PROCESSES and SESSIONS parameters in SQLPlus.*
To resolve this, you need to increase the PROCESSES
and SESSIONS
parameters. SESSIONS
is typically derived from PROCESSES
(e.g., SESSIONS = (1.5 * PROCESSES) + 22
), so increasing PROCESSES
is usually sufficient. This requires restarting the database instance.
ALTER SYSTEM SET PROCESSES = 300 SCOPE=SPFILE;
ALTER SYSTEM SET SESSIONS = 472 SCOPE=SPFILE;
-- Then restart the database instance
SHUTDOWN IMMEDIATE;
STARTUP;
Increasing PROCESSES and SESSIONS parameters (example values).
2. Listener Configuration Issues (SERVICE_NAMES)
The listener needs to be aware of the database services it should handle. This is typically configured in the listener.ora
file. If the SERVICE_NAMES
parameter is missing or incorrect, the listener might not be able to hand off connections.
# listener.ora example
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = your_db_host)(PORT = 1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = your_service_name)
(ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
(SID_NAME = your_sid)
)
)
# Ensure the SERVICE_NAMES parameter is correctly registered
# This is often handled automatically by PMON, but manual registration might be needed
# if using static registration or specific configurations.
# Check 'lsnrctl services' output to confirm registered services.
Example listener.ora
configuration snippet.
After modifying listener.ora
, you must restart the listener for changes to take effect. Use lsnrctl stop
and lsnrctl start
.
3. Shared Server vs. Dedicated Server Configuration
Oracle can operate in dedicated server mode (each connection gets its own server process) or shared server mode (multiple connections share a dispatcher process). ORA-12516 is more common in dedicated server mode when PROCESSES
limits are hit. In shared server mode, you might need to adjust DISPATCHERS
and MAX_DISPATCHERS
.
SHOW PARAMETER DISPATCHERS;
SHOW PARAMETER MAX_DISPATCHERS;
Checking shared server dispatcher parameters.
If you are using shared servers, ensure you have enough dispatchers configured. For dedicated server mode, focus on PROCESSES
and SESSIONS
.
4. JDBC Connection Pool Exhaustion
If your application uses a JDBC connection pool (e.g., Apache DBCP, HikariCP), the ORA-12516 error might indicate that the pool itself is exhausted, and new connection requests from the application are failing before they even reach the database. While not a direct database issue, it manifests similarly.
PROCESSES
or SESSIONS
limits. A common best practice is to set the pool size slightly below the database's capacity.1. Check Database Limits
Query V$PARAMETER
for PROCESSES
and SESSIONS
to understand the database's capacity.
2. Review Application Connection Pool Settings
Examine your application's configuration (e.g., maxActive
, maximumPoolSize
) to ensure it's not requesting more connections than the database can handle.
3. Adjust Database Parameters
If database limits are too low, increase PROCESSES
and SESSIONS
using ALTER SYSTEM SET ... SCOPE=SPFILE;
and restart the database.
4. Verify Listener Status
Use lsnrctl status
and lsnrctl services
on the database server to confirm the listener is running and correctly registering the database services.
5. Test Connection
After making changes, test the connection from your application or using a tool like SQL*Plus to confirm the error is resolved.