Discover SQL Time on Oracle10g I'm using Oracle10g and I have a problem that is challenging me. The application has a timeout of 45 seconds. It accesses a user from my database and always performs the same action. The problem is that the application when a session ends by timeout, ends only in the level of application not in the database.

This causes the database to continue processing and perform the action successfully, however the application execute another call causing duplication of data. (A primary key is determined by sequence)

What is my idea? End the session when the execution of certain instruction exceed 45 seconds in the database, from this specific user. The problem is that the application uses a connection pool, and the application treats those who enter or not the database.

I can not implement it for profile, because the connections are on the bench for days, and only when necessary to make the appointment.

I need to know how long it is taking a particular query to run. My need is to know when a user, it only makes a single query in the database, it times out the application, which is 45 seconds.

Where can I get this information? With it I could determine which session closed, since a profile would be unworkable.

I apologize for my bad English. I'm still learning.

Cheers
Rainier Morilla
It sounds like the transaction is being committed (perhaps automatically) even when the application times out.  Changing the COMMIT behavior would be the best option.  

If you can't do that, you could put the database action in a package and then have the package check after it runs the action to see how much time has elapsed.  If the step took more than 45 seconds then it should ROLLBACK, otherwise COMMIT.  

Although this answers your question, it is a fragile solution and you really should look into changing the COMMIT behavior or causing a database disconnect when a timeout occurs.