Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relationship between JDBC sessions and Oracle processes

We are having a problem with too many Oracle processes being created (over 2,000) when connections are limited to 1,100 (using C3P0)

Two questions:

  • What's the relationship between an Oracle process and a JDBC connection? Is one Oracle process created for each session? Is one created for every JDBC statement? No relationship at all?

  • Did you ever face this scenario, where you are creating more processes than JDBC connections?

Any comment would be really appreciated.

like image 271
Juan Avatar asked Mar 08 '12 05:03

Juan


People also ask

What is difference between session and process in Oracle?

So a process is a process and a session is a session. A session eventually needs a process, is not tied to a single process. A process can have zero one or more sessions using it.

What are sessions in Oracle database?

A database session represents an application's dialog with a relational database. This chapter is a comprehensive reference for database sessions in TopLink. It describes the fundamental concepts required to connect to the database and to perform queries as well as optional and advanced session and query properties.

What is the difference between the connections and sessions to the database?

Connection is the relationship between a client and a SQL Server database. Session is the period of time between a client logging in (connecting to) a SQL Server database and the client logging out (exiting) the SQL Server database.

What is sessions and connections to database instances?

Connection: It is the number of instances connected to the database. Sessions: A session run queries. Instance: It is a copy of the sqlservr.exe executable that runs as an operating system.


1 Answers

There is one session per connection. This sounds like you have a connection leak, somewhere you're opening a new connection and not closing properly. One possibility is that you open, use and close a connection inside a try block and are handling an exception in a catch, or returning early for someother reason. If so you need to make sure the connection close is done in finally or it may not happen, leaving the connection (and thus session) hanging. Opening two connections in the same scope without an explicit close in between can also do this.

I'm not familiar with C3PO so don't know how connections are handled, or where and how your 1100 limit is imposed; if it (or you) have a connection pool and the 1100 you refer to is the maximm pool size, then this doesn't sound like the issue as you'd hit the pool cap before the session cap.

You can look in v$session to confirm that all the sessions are coming from JDBC, and there isn't something else connecting.

like image 52
Alex Poole Avatar answered Oct 10 '22 09:10

Alex Poole