Setting Oracle 11g Session Timeout Setting Oracle 11g Session Timeout oracle oracle

Setting Oracle 11g Session Timeout


That's generally controlled by the profile associated with the user Tomcat is connecting as.

SQL> SELECT PROFILE, LIMIT FROM DBA_PROFILES WHERE RESOURCE_NAME = 'IDLE_TIME';PROFILE                        LIMIT------------------------------ ----------------------------------------DEFAULT                        UNLIMITEDSQL> SELECT PROFILE FROM DBA_USERS WHERE USERNAME = USER;PROFILE------------------------------DEFAULT

So the user I'm connected to has unlimited idle time - no time out.


Adam has already suggested database profiles.

You could check the SQLNET.ORA file. There's an EXPIRE_TIME parameter but this is for detecting lost connections, rather than terminating existing ones.

Given it happens overnight, it sounds more like an idle timeout, which could be down to a firewall between the app server and database server. Setting the EXPIRE_TIME may stop that happening (as there'll be check every 10 minutes to check the client is alive).

Or possibly the database is being shutdown and restarted and that is killing the connections.

Alternatively, you should be able to configure tomcat with a validationQuery so that it will automatically restart the connection without a tomcat restart


This is likely caused by your application's connection pool; not an Oracle DBMS issue. Most connection pools have a validate statement that can execute before giving you the connection. In oracle you would want "Select 1 from dual".

The reason it started occurring after you restarted the server is that the connection pool was probably added without a restart and you are just now experiencing the use of the connection pool for the first time. What is the modification dates on your resource files that deal with database connections?

Validate Query example:

 <Resource name="jdbc/EmployeeDB" auth="Container"             validationQuery="Select 1 from dual" type="javax.sql.DataSource" username="dbusername" password="dbpassword"            driverClassName="org.hsql.jdbcDriver" url="jdbc:HypersonicSQL:database"            maxActive="8" maxIdle="4"/>

EDIT:In the case of Grails, there are similar configuration options for the grails pool. Example for Grails 1.2 (see release notes for Grails 1.2)

dataSource {    pooled = true    dbCreate = "update"    url = "jdbc:mysql://localhost/yourDB"    driverClassName = "com.mysql.jdbc.Driver"    username = "yourUser"    password = "yourPassword"    properties {        maxActive = 50        maxIdle = 25        minIdle = 5        initialSize = 5        minEvictableIdleTimeMillis = 60000        timeBetweenEvictionRunsMillis = 60000        maxWait = 10000         }   }