Ora 12535 ошибка

ORA-12535 is the same as TNS-12535, they all indicate that the connection between the client and the listener has been timed out.

First, let’s see how we reproduce TNS-12535.

C:Usersed>tnsping compdb

TNS Ping Utility for 64-bit Windows: Version 12.1.0.1.0 - Production on 22-JUL-2014 19:03:21

Copyright (c) 1997, 2013, Oracle.  All rights reserved.

Used parameter files:
C:oracleappclientedproduct12.1.0client_1networkadminsqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = primary01)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = compdb)))
TNS-12535: TNS:operation timed out

Causes

TNS-12535 means the connect identifier can be found in tnsnames.ora and the hostname is resolvable by DNS or /etc/hosts, but somehow network problems make the connection timed out.

There could be several causes of TNS-12535 that I listed below.

  1. The hostname in the connect descriptor of compdb points to a wrong IP address.
  2. The port specified in the connect descriptor of compdb points to a wrong one.
  3. The port specified in the connect descriptor of compdb is not opened on firewall of the database server.
  4. DNS or /etc/hosts points to a wrong IP address while resolving domain name.
  5. Any other anti-virus software on clients.
  6. The server has been shutdown, there’s no way to go.

Solutions

  1. Inspect the content of tnsnames.ora closely once again to make sure there’s no any typo or mistake.
  2. Check your DNS, /etc/hosts or C:WindowsSystem32driversetchosts file to make sure the IP mapping is correct. Additionally, make sure the format of IP mapping is correct.
  3. Open the port 1521.
    • For iptables, you may refer to: Open Port 1521 on Linux 6 for Database Server.
    • For firewalld, you may refer to: Open Port 1521 on Linux 7 for Database Server.
    • For Windows platform, you may refer to: How to Open Port 1521 on Windows Server.
  4. Revert any changes of security policy on network appliances including IPS, IDS and firewall. I have ever met a case related to IPS.
  5. If the server is down, then recover server’s availability.
  6. Usually, TNS-12535 accompanies with ORA-3136 (or ORA-03136), you may consider to raise timeout period on the server.

For more connection troubleshooting, you may refer to Oracle 19c Net Services Administrator’s Guide: 15 Testing Connections.

Проблемы с listener ORA-12535: TNS:operation timed out в Oracle 9i

Одной из причин таких ошибок в часы пик может быть то, что листенер всего-навсего не успевает обработать поступающие запросы на подключение.
Например, когда одновременно запускаются очень много клиентских джобов, которые все в один момент обрушиваются на листенер, листенер успевает обработать только первые поступившие запросы, а остальные падают с ошибкой ORA-12535.

Для борьбы с ними можно попробовать следующие варианты:

1) Параметр INBOUND_CONNECT_TIMEOUT
Можно попробовать установить параметр в файле listener.ora: INBOUND_CONNECT_TIMEOUT_

= 600
Этот параметр задает кол-во секунд, в течение которых должна быть завершена обработка запроса клиента. Если за указанное время листенер не успевает обработать запрос клиента на подключение, он выдает ошибку ORA-12535 и обрывает соединение с клиентом.
Это аналог параметра CONNECT_TIMEOUT, который является устаревшим в версии 9i.

Еще можно попробовать в файле sqlnet.ora добавить параметр:
SQLNET.INBOUND_CONNECT_TIMEOUT = 700

2) Параметр QUEUESIZEС помощью этого параметра можно установить кол-во запросов, которые может обрабатывать листенер одновременно.

LISTENER_TESTDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = myhost)(Port = 2483)(QUEUESIZE=200))
)
SID_LIST_LISTENER_TESTDB =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = TESTDB)
(ORACLE_HOME = /testdb/u01/app/oracle/product/9.2.0.8.0)
(SID_NAME = TESTDB)
)
)

3) Поднятие дополнительных листенеров
Установка параметров INBOUND_CONNECT_TIMEOUT и QUEUESIZE не всегда может помочь, так как листенер работает с той же скоростью, а те запросы, которые ожидают подключения к базе, всего-навсего будут дольше удерживаться, пока не рассосется очередь. Но если очередь все-таки не рассосется за указанное время, клиенты опять упадут с ошибкой ORA-12535.

Чтоб решить проблему с производительностью раз и навсегда можно поднять дополнительные листенеры и настроить tns на стороне клиента, чтоб, если не отвечает первый листенер, запрос шел на второй, третий листенеры.

И так, на сервере поднимаем 2 листенера на 2 разных портах 2483 и 2484.
В файле listener.ora прописываем:

LISTENER_TESTDB =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = myhost)(Port = 2484))
)
SID_LIST_LISTENER_TESTDB =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = TESTDB)
(ORACLE_HOME = /testdb/u01/app/oracle/product/9.2.0.8.0)
(SID_NAME = TESTDB)
)
)

LISTENER_TESTDB2 =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(Host = myhost)(Port = 2483))
)
SID_LIST_LISTENER_TESTDB2 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = TESTDB2)
(ORACLE_HOME = /testdb/u01/app/oracle/product/9.2.0.8.0)
(SID_NAME = TESTDB2)
)
)

Запускаем листенеры:
oracle@myhost $ lsnrctl
LSNRCTL> start LISTENER_TESTDB
LSNRCTL> start LISTENER_TESTDB2

Теперь нужно на стороне клиента прописать в tnsnames.ora:
TESTDB =
(DESCRIPTION =
(ADDRESS_LIST =
(FAILOVER = ON)
(LOAD_BALANCE = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 2483))
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 2484))
)
(CONNECT_DATA = (SERVICE_NAME = TESTDB))
)
Теперь можно в $ORACLE_HOME/network/log посмотреть размеры лог файлов каждого листенера. Они будут расти по мере обработки запросов на подключение.

oracle@myhost $ ls -la *.log

I’m seeing a lot of queries from a .Net data access server I maintain timing out. It appears to be totally random with no relationship to data or data locks. For example, the following query timed out!

 SELECT NULL FROM DUAL 

The system logs show that when it happened CPU was at 20%, memory 42%, Disk 3%. What is going on?

The DB is version 10.2.0.3.0 on HPUX.
The ODP driver is 2.111.6.20 (11g driver)

I checked out the sqlnet.log and found a large number of these error messages:

***********************************************************************
Fatal NI connect error 12170.

  VERSION INFORMATION:
        TNS for HPUX: Version 10.2.0.3.0 - Production
        Oracle Bequeath NT Protocol Adapter for HPUX: Version 10.2.0.3.0 - Production
        TCP/IP NT Protocol Adapter for HPUX: Version 10.2.0.3.0 - Production
  Time: 29-JUN-2009 06:42:04
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12535
    TNS-12535: TNS:operation timed out
    ns secondary err code: 12606
    nt main err code: 0
    nt secondary err code: 0

voretaq7's user avatar

voretaq7

79.7k17 gold badges130 silver badges214 bronze badges

asked Jun 19, 2009 at 17:08

Jeff's user avatar

1

The particular error and the fact that it happens to all applications running against the database would strongly point to a network hiccup as the source of the problem.

  • How are TNS aliases resolved? Are
    you using a local tnsnames.ora file?

  • Assuming you are using a local
    tnsnames.ora file, is the TNS alias
    for the database using an IP address
    or a host name? Using an IP address
    eliminates the need to hit DNS, so it
    may be worthwhile to try that in case
    the problem is that your DNS server
    is briefly going nuts.

  • You may also try configuring a backup listener and adding a failover option to the TNS alias. If the problem is that the network hiccups and loses the packets from the client to the listener communication randomly, having a failover option that can be tried may resolve the vast majority of issues without needing to figure out what piece of the network is going flaky. Of course, that assumes that the problem corrects itself quickly enough that the next connection attempt succeeds, but that may well be a reasonable assumption. If adding a backup listener resolves the problem, you can be all but certain that it’s a network issue.

answered Jun 29, 2009 at 18:41

Justin Cave's user avatar

Justin CaveJustin Cave

9887 silver badges11 bronze badges

I’ve found that turning off connection pooling is more reliable. I ran into several situations like you describe.

It turned out that the connections are tested BEFORE they are placed back into the pool, instead of as they’re being pulled for subsequent use.

On a good day, you’ll get an error of some sort. On a bad day, you’ll just hang waiting to use a connection that is completely messed up and will never work.

If you’re going to use pooling, I read recommendations that you execute an alter command against the session. (No, I don’t know of a good one. Oracle didn’t make it any clearer in the manual)

Brad

answered Jun 19, 2009 at 18:00

Brad Bruce's user avatar

Brad BruceBrad Bruce

6168 silver badges17 bronze badges

2

I had this issue when the following conditions were true:
— JDBC Client was running on a machine with IP ZZ.ZZ.ZZ.ZZ
— Database Server had two NICs — one with IP XX.XX.XX.XX and another with YY.YY.YY.YY
— JDBC client URL was pointing to IP XX.XX.XX.XX, port 1521
— Using routing table, the client ZZ.ZZ.ZZ.ZZ was able to reach XX.XX.XX.XX
— The default «LISTENER» was listening on YY.YY.YY.YY port 1521, (hostname resolves to this IP)
— The LOCAL_LISTENER parametyer in SPFILE was NULL — that is it was never set

I resolved this by doing the following:
— Stopped the listener (lsnrctl stop)
— Changed LISTENER.ORA to listen on XX.XX.XX.XX (instead of the hostname default of YY.YY.YY.YY)
— Added an entry in TNSNAMES.ORA to set the local listener (LISTENER = (…)), essentially a copy of the entry used in LISTENER.ORA)
— Added a parameter LOCAL_LISTENER = LISTENER in spfile (ALTER SYSTEM SET … SCOPE=SPFILE)
— Restarted the LISTENER (lsnrctl start)
— Restarted the database

answered Jan 25, 2013 at 23:58

Clifford Mathew's user avatar

There’s not really enough information to come up with a solution, but here are a few things to try.

Are you able to reproduce this outside the app? Do you ever see failures with tnsping? Can you ping the server reliably?

Is the app running multiple connections in parallel? Are there limits to the number of connections?

What about the network — is there a firewall between the app and the db?

answered Jun 26, 2009 at 14:21

chris's user avatar

chrischris

3,9736 gold badges28 silver badges36 bronze badges

4

Although this is treating the symptom rather than whatever network stack disease you have, you could try increasing the
inbound_connect_timeout to see if the problem goes away.

To check what you’re running now, invoke LSNRCTL on the database host and issue the command:

show inbound_connect_timeout

You have to change this in your db host’s sqlnet.ora and listener.ora files:

sqlnet.ora:
SQLNET.INBOUND_CONNECT_TIMEOUT = 100 (assuming 100 is greater than your current timeout)

listener.ora:
INBOUND_CONNECT_TIMEOUT_yourLIstenerNameGoesHere = 100

answered Jun 30, 2009 at 19:04

user11222's user avatar

Check also your firewall. Inbound port 1521 on the database server should be open (if you are connecting to the DB server from another server) .

answered Jun 12, 2015 at 13:24

Eloy's user avatar

I have just managed to resolve this issue, I have figured out that if you are running on DHCP server, make sure your host file has the current correct IP address, C:windowssystem32driversetchost (open it using notepad) & this will fix your problem.

chicks's user avatar

chicks

3,77310 gold badges27 silver badges36 bronze badges

answered Mar 10, 2017 at 16:34

Kabotsa's user avatar

Additional Tips: Please check your server/PC firewall settings. On some windows operating system such as Vista/Win7/Win Server; firewall is enable for SOHO network computers. Make sure to test all network groups private/office/public.
Then stop the firewall service and test for the connection.

answered Jun 2, 2017 at 19:33

Yared's user avatar

YaredYared

111 bronze badge

1-

Symptoms

Oracle Net connections to database fail with error code TNS-12535 / ORA-12535: TNS:operation timed out. Oracle Net client trace can show large delay upon resolving TNS listener host

Cause
Operating system error connection timed out. The TNS listener is unable to service the requests quickly enough. The TNS listener has a queue (backlog) of connection requests that it needs to service. If it is unable to service these quick enough, they will start to timeout.

Solution

The size of the TNS listener queue can be influenced by setting parameter QUEUESIZE in the listener.ora file.   To specify a queue size for a listener, enter a value to the QUEUESIZE parameter at the end of any listening address:

LISTENER =
  (ADDRESS =(PROTOCOL = TCP)(HOST=SAMPLE.COM)(PORT = 1521)(QUEUESIZE=99)) 

Default LISTENER.ORA queue sizes

Solaris default QUEUESIZE is 5
Aix default QUEUESIZE is 1024
Linux Default QUEUESIZE is 1024
Windows default QUEUESIZE is 50

Ref: 214122.1

2-

Brief notes:

— In essence, the ORA-12535/TNS-12535 is a timing issue between the client and server.
— The TNS-12535 or ORA-12535 error is commonly a timeout error associated with Firewalls or slow Networks.
— It can also be due to an incorrect «timeout» parameter setting for the following files:
listener.ora —>
CONNECT_TIMEOUT_

(8.1.x and lower only)
or
INBOUND_CONNECT_TIMEOUT_ (9.2 and above)
sqlnet.ora —>
SQLNET.INBOUND_CONNECT_TIMEOUT (9.2 and up). 

Ref: 125351.1

3-  TNSPING command fails with the TNS-12535 error:

Cause 

Personal Firewall enabled on Client system.

Solution

To implement the solution, please execute the following steps:

Add the Oracle Client side applications to the Windows Firewall Exception List.

Click Start, Control Panel, and double click ‘Windows Firewall’  Next, select the ‘Exceptions Tab’
Use the ‘Add Program…’ dialog to add the programs to the Exception List.
If unable to navigate to the ‘Windows Firewall’ configurations window, you may be able to manually access the Window Firewall in Windows XP SP2 window by:
Clicking Start, click Run, type Firewall.cpl, and then click OK  Then from there you can edit the programs from the Exceptions Tab.

Ref: 341216.1

4-  Connect as SYSDBA Fails with TNS-12535 ,Can not start database

cause: Log files were being written from the ORASRV_BEQ_.COM file and the 32k version limit had been reached
fix:
Delete the log files.


These days everything goes to the cloud or it has been collocated somewhere in a shared infrastructure. In this post I’ll talk about sessions being disconnected from your databases, firewalls and dead connection detection.

Changes

We moved number of 11g databases from one data centre to another.

Symptoms

Now probably many of you have seen the following error in your database alertlog «TNS-12535: TNS:operation timed out» or if you haven’t you will definitely see it some day.

Consider the following error from database alert log:

Fatal NI connect error 12170.

  VERSION INFORMATION:
        TNS for Linux: Version 11.2.0.3.0 - Production
        Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.3.0 - Production
        TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.3.0 - Production
  Time: 12-MAR-2015 10:28:08
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12535

TNS-12535: TNS:operation timed out
    ns secondary err code: 12560
    nt main err code: 505

TNS-00505: Operation timed out
    nt secondary err code: 110
    nt OS err code: 0
  Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.10)(PORT=49831))
Thu Mar 12 10:28:09 2015

Now this error indicate timing issues between the server and the client. It’s important to mention that those errors are RESULTANT, they are informational and not the actual cause of the disconnect. Although this error might happen for number of reasons it is commonly associated with firewalls or slow networks.

Troubleshooting

The best way to understand what’s happening is to build a histogram of the duration of the sessions. In particular we want to understand whether disconnects are sporadic and random or they follow a specific pattern.

To do so you need to parse the listener log and locate the following line from the above example:

(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.10)(PORT=49831))

Since the port is random you might not get same record or if you do it might be days apart.

Here’s what I found in the listener:

12-MAR-2015 08:16:52 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)(CID=(PROGRAM=app)(HOST=apps01)(USER=scott))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.10)(PORT=49831)) * establish * ORCL * 0

In other words — at 8:16 the user scott established connection from host 192.168.0.10.

Now if you compare both records you’ll get the duration of the session:

Established: 12-MAR-2015 08:16:52
Disconnected: Thu Mar 12 10:28:09 2015

Here are couple of other examples:
alertlog:

Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.10)(PORT=20620))
Thu Mar 12 10:31:20 2015

listener.log:

12-MAR-2015 08:20:04 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)(CID=(PROGRAM=app)(HOST=apps01)(USER=scott))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.10)(PORT=20620)) * establish * ORCL * 0

alertlog:

Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.10)(PORT=48157))
Thu Mar 12 10:37:51 2015

listener.log:

12-MAR-2015 08:26:36 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)(CID=(PROGRAM=app)(HOST=apps01)(USER=scott))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.10)(PORT=48157)) * establish * ORCL * 0

alertlog:

Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.11)(PORT=42618))
Tue Mar 10 19:09:09 2015

listener.log

10-MAR-2015 16:57:54 * (CONNECT_DATA=(CID=(PROGRAM=)(HOST=__jdbc__)(USER=root))(SERVICE_NAME=ORCL1)(SERVER=DEDICATED)) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.0.11)(PORT=42618)) * establish * ORCL1 * 0

As you may have noticed the errors follow very strict pattern — each one gets disconnect exactly 2hrs 11mins after it has been established.

Cause

Given the repetitive behaviour of the issue and that it happened for multiple databases and application servers we can conclude that’s definitely a firewall issue.

The firewall recognizes the TCP protocol and keeps a record of established connections and it also recognizes TCP connection closure packets (TCP FIN type packet). However sometimes the client may abruptly end communication without closing the end points properly by sending FIN packet in which case the firewall will not know that the end-points will no longer use the opened channel. To resolve this problem firewall imposes a BLACKOUT on those connections that stay idle for a predefined amount of time.

The only issues with BLACKOUT is that neither or the sides will be notified.

In our case the firewall will disconnect IDLE sessions after around 2hrs of inactivity.

Solution

The solution for database server is to use Dead Connection Detection (DCD) feature. DCD detects when a connection has terminated unexpectedly and flags the dead session so PMON can release the resources associated with it.

DCD sets a timer when a session is initiated and when the timer expires SQL*Net on the server sends a small 10 bytes probe packet to the client to make sure connection is still active. If the client has terminated unexpectedly the server will get an error and the connection will be closed and the associated resources will be released. If the connection is still active then the probe packet is discarded and the timer is reset.

To enable DCD you need to set SQLNET.EXPIRE_TIME in sqlnet.ora of you RDBMS home!
cat >> $ORACLE_HOME/network/admin/sqlnet.ora
SQLNET.EXPIRE_TIME=10

This will set the timer to 10 minutes. Remember that sessions need to reconnect for the change to take place it won’t work for existing connections.

Firewalls become smarter and they can now inspect packages even deeper. Make sure the following settings are also disabled:

  • SQLNet fixup protocol
  • Deep Packet Inspection (DPI)
  • SQLNet packet inspection
  • SQL Fixup

I had similar issue with Dataguard already, read more here:
Smart Firewalls

How to test Dead Connection Detection

You might want to test or make sure DCD really works. You’ve got multiple options here — Oracle SQL client trace, Oracle SQL Server Trace, Sniff the network with packet analyzer OR using strace to trace the server process. I used strace since I had access to the database server and it was non intrusive.

  • Establish a connection to the database through SQL*Net

  • Find the processes number for your session:

SQL> select SPID from v$process where ADDR in (select PADDR from v$session where username='SVE');

SPID
------------------------
62761
  • Trace the process:
[oracle@dbsrv ~]$ strace -tt -f -p 62761
Process 62761 attached - interrupt to quit
11:36:58.158348 --- SIGALRM (Alarm clock) @ 0 (0) ---
11:36:58.158485 rt_sigprocmask(SIG_BLOCK, [], NULL, 8) = 0
....
11:46:58.240065 --- SIGALRM (Alarm clock) @ 0 (0) ---
11:46:58.240211 rt_sigprocmask(SIG_BLOCK, [], NULL, 8) = 0
...
11:46:58.331063 write(20, "n620", 10) = 10
...

What I did was to attach to the process, simulate some activity at 11:36 and then leave the session IDLE. Then 10 minutes later the server process sent an empty packet to the client to check if the connection is still alive.

Conclusion

Errors in alertlog disappeared after I enabled the DCD.

Make sure to enable DCD if you host your databases in a shared infrastructure or there are firewalls between your database and application servers.

References

How to Check if Dead Connection Detection (DCD) is Enabled in 9i ,10g and 11g (Doc ID 395505.1)
Alert Log Errors: 12170 TNS-12535/TNS-00505: Operation Timed Out (Doc ID 1628949.1)
Resolving Problems with Connection Idle Timeout With Firewall (Doc ID 257650.1)
Dead Connection Detection (DCD) Explained (Doc ID 151972.1)

Понравилась статья? Поделить с друзьями:
  • Ora 12504 ошибка
  • Ora 12170 tns connect timeout occurred ошибка
  • Ora 01045 ошибка
  • Ora 01033 ошибка как исправить
  • Ora 01031 insufficient privileges ошибка