Ошибка oracle got minus one from a read call
Я использую Oracle 11GR2 на инстансе Amazon RDS. иногда я получаю IO Error: Got minus one from a read call при звонке на DriverManager.getConnection(getUrl()) , и я не знаю почему. Остальные приложения работают корректно.
Чтобы еще больше запутать ситуацию, ошибка будет исправляться сама собой (после следующей итерации программы).
Что делать с ошибкой «Получил минус один из вызова чтения»?
Полная трассировка стека:
Database.java, строка 44: setConn(DriverManager.getConnection(getUrl()));
- Я думал, что это плохой URL-адрес JDBC, но он действительно работает, иногда целыми днями, прежде чем сбой.
- Amazon RDS является управляемым экземпляром, и изменение конфигурации может быть невозможно.
- Я использую ojdbc6.jar для подключения
Непосредственной причиной проблемы является то, что драйвер JDBC попытался выполнить чтение из сетевого сокета, который был закрыт «другим концом».
Это могло быть связано с несколькими причинами:
Если удаленный сервер был настроен (например, в файле "SQLNET.ora"), чтобы не принимать соединения с вашего IP.
Если URL-адрес JDBC неверен, возможно, вы пытаетесь подключиться к чему-то, что не является базой данных.
Если существует слишком много открытых подключений к службе базы данных, она может отклонить новые подключения.
Учитывая симптомы, я думаю, что сценарий «слишком много связей» наиболее вероятен. Это говорит о том, что в вашем приложении происходит утечка соединений; то есть создание соединений, а затем невозможность (всегда) их закрытия.
Мы столкнулись с той же проблемой и исправили ее. Ниже приводится причина и решение.
Проблема
Когда используется механизм пула соединений, сервер приложений (в нашем случае это JBOSS) создает соединения в соответствии с параметром min-connection . Если у вас работает 10 приложений, и у каждого min-connection 10, то в базе данных будет создано всего 100 сеансов. Кроме того, в каждой базе данных есть параметр max-session , если ваше общее количество подключений пересекает эту границу, вы получите Got minus one from a read call .
К вашему сведению: используйте запрос ниже, чтобы узнать общее количество сеансов:
Решение: с помощью нашего администратора базы данных мы увеличили этот параметр max-session , чтобы все наше приложение min-connection могло его разместить.
Я хотел бы дополнить ответ Стивена Си, мой случай был на первой точке. Итак, поскольку у нас есть DHCP для распределения IP-адресов в компании, DHCP изменил адрес моей машины, разумеется, не спрашивая ни меня, ни Oracle. Поэтому неожиданно оракул отказался что-либо делать и сделал ужасное исключение минус один. Так что, если вы хотите обойти это раз и навсегда, и поскольку TCP.INVITED_NODES файла SQLNET.ora не принимает подстановочные знаки, как указано здесь, вы можете добавить имя хоста вашего компьютера вместо IP-адреса.
В моем случае я получил такое же исключение, потому что пользователь, которого я настроил в приложении, не существовал в БД, создание пользователя и предоставление необходимых разрешений решило проблему.
When I run the sql developer and set the all data,click the connect but i get this error:
I am beginner in Oracle. How can I solve that error?
I use 64-bit Windows7 and oracle 12c.
Its all about Databases & their performance, troubleshooting & much more …. ¯\_(ツ)_/¯
6 Answers 6
The immediate cause of the problem is that the JDBC driver has attempted to read from a network Socket that has been closed by "the other end".
This could be due to a few things:
If the remote server has been configured (e.g. in the "SQLNET.ora" file) to not accept connections from your IP.
If the JDBC url is incorrect, you could be attempting to connect to something that isn't a database.
If there are too many open connections to the database service, it could refuse new connections.
Given the symptoms, I think the "too many connections" scenario is the most likely. That suggests that your application is leaking connections; i.e. creating connections and then failing to (always) close them.
We faced the same issue and fixed it. Below is the reason and solution.
Problem
When the connection pool mechanism is used, the application server (in our case, it is JBOSS) creates connections according to the min-connection parameter. If you have 10 applications running, and each has a min-connection of 10, then a total of 100 sessions will be created in the database. Also, in every database, there is a max-session parameter, if your total number of connections crosses that border, then you will get Got minus one from a read call .
FYI: Use the query below to see your total number of sessions:
Solution: With the help of our DBA, we increased that max-session parameter, so that all our application min-connection can accommodate.
JDBC client is unable to connect to 12c database on SSL port. An external user identified by cert values is created and given create session privilege is created (database server configuration as described in How To Setup The Database And The Client To Have SSL Mutual Authentication With An Oracle Jdbc Thin Client And The Database). However, when the client tries to connect, the following error is raised:
Tnsping to SSL from server works fine.
TCP connections also work successfully.
At the time of the application exception, the listener.log shows the following errors:
TNS-12537: TNS:connection closed
TNS-12560: TNS:protocol adapter error
TNS-00507: Connection closed
IBM/AIX RISC System/6000 Error: 55: Operation now in progress
TNS-12561: TNS:unknown error
and the database alert.log shows:
TNS-12560: TNS:protocol adapter error
ns secondary err code: 0
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Wed May 17 17:51:29 2017
opiodr aborting process unknown ospid (23199876) as a result of ORA-609
ERROR
-----------------------
Got minus one from a read call
STEPS
-----------------------
The issue can be reproduced at will with the following steps:
1.Configure database server as described in How To Setup The Database And The Client To Have SSL Mutual Authentication With An Oracle Jdbc Thin Client And The Database?.
2. Try to establish a connection from JDBC using TCPS.
Cause
Likes
Archives:
Prashant Dixit is the 'FatDBA' .
10 Answers 10
In my case the error is connected to a problem about the client's (SQL Developer) ojdbc8 driver and the Oracle 19.3 docker container. The solution for me was to set a system property on the client -- you can do it within the JDBC connection string):
This is the thread that lead me to the answer.
You can also solve this problem by dissabling OOB on server side in the sqlnet.ora:
Another workaround is to use the ojdbc7 driver.
Hope this helps some of us.
FYI. I applied this fix to my testcontainer setup. Locally nothing bad happened, Jenkins however failed with this elusive "IO Error: Got minus one from a read call". This actually worked, however. I have no idea why and, to me, it makes 0 sense.
@dougd_in_nc Sorry for the late answer, just read it. In the connection properties of your db connection in sqldeveloper u can switch the connection type to "custom jdbc" and enter the connection string in there
The port you are looking for is 1521 if it wasn't altered. If it was check the $ORACLE_HOME/network/admin/listener.ora for the proper port number.
You need set "tcp.validnode_checking = no" or comment this parameter in sqlnet.ora file then restart listener on db server and test again.
I got the same issue but following steps worked for me, it seems Gaurav also has shared it already:
Seems you have enabled ACL on the listener.
You can follow these steps to avoid the error:
Hope that helps
Ensure the DB is up and running and you can connect locally AS SYSDBA to the database using Oracle binaries owner (usually oracle:oinstall Unix / Linux user). If it does not work, probably you encounter a different problem. Check privileges of an Oracle file on Unix / Linux host where database is running:
Change permissions as below:
Most of the answers out there for this problem point to using the wrong PORT number in your connection options, or similar. In my case, after a couple hours of searching, the reason showed to be something else.
Mind which user you are using when starting Oracle listener. You should do it with the oracle user, not as root. Otherwise you end up with listener files being created as e.g. user deamon group root instead of user oracle group dba. This in turn leads to:
To check whether this is the case, go to
Unfortunately sqldeveloper doesn't show the full stack-trace when reading "Got minus one from a read call". I could find the problem thanks to switching to SQL-Squirrel.
I'm running Oracle 11GR2 on an Amazon RDS instance. occasionally I get an IO Error: Got minus one from a read call when making a call to DriverManager.getConnection(getUrl()) and I'm not sure why. Other applications work correctly.
To further confuse things, the error will correct itself on occasion (following next iteration of the program).
How should I approach a "Got minus one from a read call" error?
Full stack trace:
Database.java line 44: setConn(DriverManager.getConnection(getUrl()));
- I thought it was a bad JDBC url, but it does work, sometimes for days on end before failing.
- Amazon RDS is a managed instance and configuration changes may not be possible
- I am using ojdbc6.jar for connectivity
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document
Symptoms |
Cause |
Solution |
References |
My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.
Follow me on Twitter
Posted by FatDBA on September 3, 2020
Would like to discuss one problem that I was facing today in on one of the Oracle 12c Release 1 standalone database where application team started explaining the problem that they are getting when doing application restart, specially oracle NET exception of ‘Got minus one from a read call‘
They were suspecting the issue with the high number of opened files on OS. The files count was too high when listing using lsof command on this RHEL7 system and the count goes down once the services are stopped. well I was able to explain the difference that exists between RHEL6 & RHEL7 when doing count using lsof. It was in RHEL7/EL7 that shows output including TID as default compared to RHEL6/OL6. Hence the number of open files count increases in RHEL7 as compared to RHEL6. So, it has nothing to do with the error that they have reported.
So, next we have checked database alert log and it was all good, all clean, no errors nothing. I immediately checked the value of “OS_AUTHENT_PREFIX” parameter as it specifies a prefix that Oracle uses to authenticate users attempting to connect to the system. Oracle simply appends this value to the beginning of user’s operating system account name and password and which it later on compares. So, it was set to its default value that is OPS$ and was set for the backward compatibility with previous versions.
So, I have two solutions for the problem
– Set “OS_AUTHENT_PREFIX” to “” (a null string), thereby eliminating the addition of any prefix to operating system account names.
– Set “tcp.validnode_checking = no” in SQLNET.ora file
This is to enable and disable valid node checking for incoming connections. If this parameter is set to yes, then incoming connections are allowed only if they originate from a node that conforms to list specified by TCP.INVITED_NODES or TCP.EXCLUDED_NODES parameters.
So, I tried with the first option and rebooted the database to make changes persistent (this parameter is static) and asked application team to give it a try again, and as expected it worked. The error or the ORACLE NET exception ‘Got minus one from a read call‘ was resolved after applying the first fix itself.
Here the second option is valid too as that also does the same thing, but one fix at a time.
Читайте также: