Oracle Keep Alive Test SQL_NET.EXPIRE_TIME not working - oracle

I have been trying to successfully configure oracle database 11g with dead connection detection keep alive settings without changing any tcp settings. I went into $ORACLE_HOME/network/admin/sqlnet.ora and set the oracle keep alive to 10 minutes (SQL_NET.EXPIRE_TIME = 10). I also went into tnsnames.ora file and added the ENABLE=BROKEN parameter to the net_service_name. In one terminal I find the Oracle session process ID and then open a second terminal where I use the Linux trace tool to verify there is a write after 10 minutes. Unfortunately there is no write after 10 minutes. The only time there is a write is when the original oracle session being traced is disconnected or there is activity being performed in this session. I am trying to figure out how to resolve the issue of not seeing a write every 10 minutes to verify the server process sent an empty packet to the client.

Related

JDBC and Connection reset.

I am writing resultsets to Excel using the Apache POI. The resultsets are created by via JDBC connections to SQL Server 2014.
The calling method has the code
ExportLargeResultSetoExcel publishQry = new ExportLargeResultSetoExcel();
publishQry.generateExcel(rs, FILE_TO_WRITE);
Until yesterday, the code was working fine. But, starting today, a connection reset happens after processing a few 100 rows. If the result set has about 10 or 50 rows, the excel is being created. But, if there are 1000 rows, the connection is being reset after looping through, say, about 900 rows. I researched other posts here on stackflow, and other forums. I have SQL Server installed on my desktop. I checked the Configuration Tool Manager settings, ports and enabled TCP/IP services as suggested in some of the postings here. However, I believe they would not have any impact because they are affecting only the local settings. I trapped the SQLServerException and it returned a SQLState of 08S01. Below is the detailed stacktrace of the exception. Is there a way I could get the connection time out programmatically? Could someone help and suggest what could be going wrong?
2016-12-25 17:03:32.791 1. ResultSet.getString(3)
com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2399)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2383)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1884)
at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:6642)
at com.microsoft.sqlserver.jdbc.TDSReader.nextPacket(IOBuffer.java:6595)
at com.microsoft.sqlserver.jdbc.TDSReader.ensurePayload(IOBuffer.java:6571)
at com.microsoft.sqlserver.jdbc.TDSReader.readBytes(IOBuffer.java:6864)
at com.microsoft.sqlserver.jdbc.TDSReader.readWrappedBytes(IOBuffer.java:6886)
at com.microsoft.sqlserver.jdbc.TDSReader.readInt(IOBuffer.java:6827)
at com.microsoft.sqlserver.jdbc.ServerDTVImpl.getValue(dtv.java:4080)
at com.microsoft.sqlserver.jdbc.DTV.getValue(dtv.java:226)
at com.microsoft.sqlserver.jdbc.Column.getValue(Column.java:144)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getValue(SQLServerResultSet.java:2099)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getValue(SQLServerResultSet.java:2084)
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.getString(SQLServerResultSet.java:2427)
at net.sf.log4jdbc.ResultSetSpy.getString(ResultSetSpy.java:2413)
at fnSampleTest.ExportLargeResultSetoExcel.generateExcel(ExportLargeResultSetoExcel.java:148)

TNS-connection closed error while updating oracle tables from Informatica powercenter

I often get below error while running some sessions in Informatica Powercenter. The session is supposed to insert/update some records in oracle tables.
Username USER123 DB Error -1
Database driver Error...
Function Name: Logon
ORA-12537: TNS-connection closed
Database Error: Failed to connect to database using user [USER123] and connection string [ORCL123]
This is totally random. I have ran the same sessions sometimes smoothly without a singe hitch. But sometimes the error comes back again and again. Whenever it occurs, stays for 5 mins max, means if I restart the session immediately after failure, it will fail again. But if I wait for 5 mins and restart them again, it runs successfully. But the only problem is it comes back again in another half an hour or so.
Can somebody enlighten me to get a probable resolution for the error?
Do check the number of connections allowed on the Oracle instance if they are exceeding intermittently by other users and refusing your user connection from Informatica.

How to keep alive the connection in PL/SQL Developer?

I am using PL/SQL Developer 11.0.4.1774. In my work, I need to use database whole day. Sometimes, during 30-60 minutes, I do not use ide and when I need to use it again, it requires reconnection.
I do not want to reconnect, is there any way to keep the connection alive whole day?
Go to Tools --> Preferences and click "Check connection". It pings the database every 60 seconds, making the session active and avoids idle session disconnects caused by profiles.
NOTE: This question and answer are for Allround Automations PL/SQL Developer. See this question if you're looking for Oracle SQL Developer.
you need check 'IDLE_TIME' and 'CONNECT_TIME' setting for your user profile
select * from dba_profiles
where resource_name in ('IDLE_TIME','CONNECT_TIME')
http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_6010.htm
If a user exceeds the CONNECT_TIME or IDLE_TIME session resource
limit, then the database rolls back the current transaction and ends
the session. When the user process next issues a call, the database
returns an error.
I have PL/SQL Developer opens for days and don't have the issue
my PL/SQL Dev Tools-Prefernces-connection settings are:
Session Mode = Multy Session
Check connection = unchecked
Logoff with open transaction = Commit
and TIME settings are:
PROFILE RESOURCE_NAME RESOURCE_TYPE LIMIT
1 DEFAULT IDLE_TIME KERNEL UNLIMITED
2 DEFAULT CONNECT_TIME KERNEL UNLIMITED
Install the Reconnect plug-in so at least reconnecting can be a simple button-press.
Possibly against the intention of the DBA (if the issue is due to profile/resource manager settings), but you might try setting a Sessions window (or other report/query etc) to auto-refresh every 25 minutes or so.
Edit: I see on the Bar Solutions website the developer has moved Reconnect from "Plugins" to "Old Plugins". At my current client site I can't install plugins, so I can't tell whether it still works at the moment.

database stopped on running 500 quires per second

I built a chat application in which chatting page is loaded per every 1second through AJAX,
And i used DB2 express-c database for storing messages.
one day 500 user at a time used this app at a that time database is stopped working.
Is their any effect on database by running 500 quires at a time in one second.
please tell how to run quires for every second without effecting the database functionality.
The red mark on the DB2 icon means that the instance stop working. This issue should be related to a memory problem or something else.
You have to check the db2diag.log file, and check for message. It is highly probable that you have information at the time when the instance stopped. The first failrue data capture feature allows to recopile all that information when a crash occurs, in the diag directory.
In order to fix the problem, you just need to restart DB2. You can create a task that check if the instance is up, and if not, try to restarted. However, this is the wrong way to keep DB2 up.
You should see what happened at the time when DB2 crashed. Probably, the memory for the 500 agents was too high, and DB2 could not reserve more memory.
Are you running other processes in the same DB2 server? probably one of them corrupt the DB2 memory.

Oracle ALTER SESSION ADVISE COMMIT?

My app to recovers automatically from failures. I test it as follows:
Start app
In the middle of processing, kill the application server host (shutdown -r -f)
On host reboot, application server restarts (as a windows service)
Application restarts
Application tries to process, but is blocked by incomplete 2-phase commit transaction in Oracle DB from previous session.
Somewhere between 10 and 30 minutes later the DB resolves the prior txn and processing continues OK.
I need it to continue processing faster than this. My DBA advises that I should prefix my statement with
ALTER SESSION ADVISE COMMIT;
But he can't give me guarantees or details about the potential for data loss doing this.
Luckily the statement in question is simply updating a datetime value to SYSDATE every second or so, so if there was some data corruption it would last < 1 second before it was overwritten.
But, to my question. What exactly does the statement above do? How does Oracle resolve data synchronisation issues when it is used?
Can you clarify the role of the 'local' and 'remote' databases in your scenario.
Generally a multi-db transaction does the following
Starts the transaction
Makes a change on on database
Makes a change on the other database
Gets the other database to 'promise to commit'
Commits locally
Gets the remote db to commit
In doubt transactions happen if step 4 is completed and then something fails. The general practice is to get the remote database back up and confirm if it committed. If so, step (5) goes ahead. If the remote component of the transaction can't be committed, the local component is rolled back.
Your description seems to refer to an app server failure which is a different kettle of fish. In your case, I think the scenario is as follows :
App server takes a connection and starts a transaction
App server dies without committing
App server restarts and make a new database connection
App server starts a new transaction on the new connection
New transaction get 'stuck' waiting for a lock held by the old connection/transaction
After 20 minutes, dead connection is terminated and transaction rolled back
New transaction then continues
In which case the solution is to kill off the old connection quicker, with a shorter timeout (eg SQLNET_EXPIRE_TIME in the sqlnet.ora of the server) or a manual ALTER SYSTEM KILL SESSION.

Resources