Skip to main content

TNS-12520: cannot connect

When to use it

New connections fail with TNS-12520 or ORA-12520 (listener could not find available handler), while existing sessions keep working.

Run this

Connect locally on the server, which does not go through the listener, and check the limits:

sqlplus / as sysdba
SELECT resource_name, current_utilization, max_utilization, limit_value
FROM   v$resource_limit
WHERE  resource_name IN ('processes', 'sessions');

Full guided diagnosis: diagnose_tns_12520.sh (Administration › Utility scripts › Connectivity): checks process limits in the database and the operating system, the listener services and the PDB state. The last steps of that script close and reopen a PDB: do not run those without approval.

How to read the output

  • If current_utilization for processes is at or very near limit_value, the database has no room for new connections. This is the most common cause.
  • If there is room, check the listener with lsnrctl services. A service in state blocked or missing from the list points to registration problems.
  • If you cannot connect locally either, the problem is bigger than the listener. Escalate.

What to do next

  • Find out which user holds the sessions with "Who is connected" in chapter 4 and tell the application team.
  • Freeing sessions means killing them, which needs confirmation. See "Killing a session safely".
  • A permanent fix (a higher processes value, a smaller connection pool) is a decision for a senior DBA.

Risk level

READ ONLY Safe to run at any time. It only queries the data dictionary.