Oracle Sessions not being removed when connection closed.
374328Mar 3 2003 — edited Apr 8 2003Hi,
I'm not sure if I understand this behavior correctly. Here is an example of code to execute a procedure:
Dim con As Oracle.DataAccess.Client.OracleConnection = New Oracle.DataAccess.Client.OracleConnection("Data Source=TEST;User ID =test;Password = test;Connection Lifetime = 15")
Dim oraCMD As New Oracle.DataAccess.Client.OracleCommand()
oraCMD.Connection = con
oraCMD.CommandType = CommandType.StoredProcedure
con.Open()
oraCMD.CommandText = "pkgDataAdmin.GetDisciplines"
oraCMD.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("GetAll", Oracle.DataAccess.Client.OracleDbType.Int16, 1, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Default, 0))
oraCMD.Parameters.Add(New Oracle.DataAccess.Client.OracleParameter("DisciplineRows", Oracle.DataAccess.Client.OracleDbType.RefCursor, 1000, ParameterDirection.Output, True, 0, 0, "", DataRowVersion.Default, Convert.DBNull))
oraCMD.ExecuteNonQuery()
oraCMD.Dispose()
con.Close()
con.Dispose()
What I am not understanding is that when I open the connection, a session is alotted within Oracle. I'd assume that when I close the connection that the session would be removed from memory, but it is not. It remains, but it is inactive. If I put this code on a page and refresh it a few times, I'll get multiple sessions created, which seem to never get destroyed unless I kill them manually.
Can I ensure that the session gets removed when I am done with the connection? This became an issue when performing load testing on an app and eventually we ran out of processes due to multiple inactive sessions.