The difference of Connection vs Session in Oracle
2013-09-25 15:39
453 查看
Sometimes it is easy to confuse Oracle connection with Oracle session, but one saying is a connection can have 0, 1 or more sessions, and gives SQL*Plus as example. It is true but for a java developer it is a little hard to get.
It is better to go to official document for reference but not find post/blog to help understand. in Oracle Database Concepts, 10g Release 2 (10.2):
but are very different in meaning.
A connection is a communication pathway between a user process and an Oracle
instance. A communication pathway is established using available interprocess
communication mechanisms (on a computer that runs both the user process and
Oracle) or network software (when different computers run the database application
and Oracle, and communicate through a network).
A session is a specific connection of a user to an Oracle instance through a user
process.
In configurations without the shared server, Oracle creates a server process on behalf
of each user session. However, with the shared server, many user sessions can share a
single server process.
From this definition, it accentuates that session is also a connection (just specific), and in last paragraph, it mentioned Shared Server and another server process (actually it is Dedicated Server), so the difference is dropped on the difference of server
process. (Shared Server vs Dedicated Server)
![](https://oscdn.geek-share.com/Uploads/Images/Content/202007/22/8ef69ca00da50f3b08d6bc4ef3569e10)
Dedicated Server process maintains a one-to-one ratio between the number of user processes and server processes. Even when the user is not actively making a database request, the dedicated server process remains (though it is inactive and can be paged out
on some operating systems). In other words, in this model, one connection corresponds one session.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202007/22/f79bfbfdfb6533050cbdb2c916309c58)
Abover picture contains two graphs, left is the scenario that the user process and the dedicated server process run on different computers while right is the user process and the dedicated server process run on the same computer, the communication mechanisms
are different. But each session occupies a connection, one-one-mapping.
Shared server architectureeliminates the need for a dedicated server process for each connection.A dispatcher directs multiple incoming network session requests to a pool of shared server processes.
![](https://oscdn.geek-share.com/Uploads/Images/Content/202007/22/51d3f4732bf95505ae78a75dd477b43d)
Once User Process ties Server Process then an Oracle Connection is established. If this connection contains Dedicated Server Process + User Process, then this connection contains only one session. If this connection contains a Shared Server Process + User
Process, due to Shared Server Process can handle many User Process, so this connection can contain many sessions.
There is a Connection as long as a User Process is there, in JDBC, the connection is a session in Oracle. Like J2EE application, if app just finishes a transaction, and no user does any action, then no session, but app is running, it is a User Process which
occupies a Connection. Now this connection has 0 session.
There is another article:session 和connection的不同 is good to read.
It is better to go to official document for reference but not find post/blog to help understand. in Oracle Database Concepts, 10g Release 2 (10.2):
Connections and Sessions
Connection and session are closely related to user processbut are very different in meaning.
A connection is a communication pathway between a user process and an Oracle
instance. A communication pathway is established using available interprocess
communication mechanisms (on a computer that runs both the user process and
Oracle) or network software (when different computers run the database application
and Oracle, and communicate through a network).
A session is a specific connection of a user to an Oracle instance through a user
process.
In configurations without the shared server, Oracle creates a server process on behalf
of each user session. However, with the shared server, many user sessions can share a
single server process.
From this definition, it accentuates that session is also a connection (just specific), and in last paragraph, it mentioned Shared Server and another server process (actually it is Dedicated Server), so the difference is dropped on the difference of server
process. (Shared Server vs Dedicated Server)
Dedicated Server process maintains a one-to-one ratio between the number of user processes and server processes. Even when the user is not actively making a database request, the dedicated server process remains (though it is inactive and can be paged out
on some operating systems). In other words, in this model, one connection corresponds one session.
Abover picture contains two graphs, left is the scenario that the user process and the dedicated server process run on different computers while right is the user process and the dedicated server process run on the same computer, the communication mechanisms
are different. But each session occupies a connection, one-one-mapping.
Shared server architectureeliminates the need for a dedicated server process for each connection.A dispatcher directs multiple incoming network session requests to a pool of shared server processes.
Once User Process ties Server Process then an Oracle Connection is established. If this connection contains Dedicated Server Process + User Process, then this connection contains only one session. If this connection contains a Shared Server Process + User
Process, due to Shared Server Process can handle many User Process, so this connection can contain many sessions.
There is a Connection as long as a User Process is there, in JDBC, the connection is a session in Oracle. Like J2EE application, if app just finishes a transaction, and no user does any action, then no session, but app is running, it is a User Process which
occupies a Connection. Now this connection has 0 session.
There is another article:session 和connection的不同 is good to read.
相关文章推荐
- The Excel Connection Manager is not supported in the 64-bit version of SSIS
- 评论数据库Win A Free Copy of Packt’s Managing Multimedia and Unstructured Data in the Oracle Database e-book
- the connection to the VMware USB Arbitration Service was unsuccessful.Please check the status of this service in the Microsogt M
- 连接数据库时的异常:TNS:listener does not currently know of SID given in connect descriptor The Connection descriptor used by the client was: localhost:1521:orc
- How to change the language of oracle sqlplus from chinese to english in windows(如何将oracle sql plus中的中文变成英文版)
- Server-02 To view the connection number of shared folder in windows OS
- What's the difference of name scope and a variable scope in tensorflow?
- The difference of static, readonly and const in C#
- The Excel Connection Manager is not supported in the 64-bit version of SSIS, as no OLE DB provider i
- Oracle EBS R12 - SQL to find session ID of the running request from request ID
- what is the difference of select single and select up to one row in abap
- A VS.NET add-in to know the content of the any dataset during debugging
- The Difference in PIM Dense vs. DVMRP
- In Oracle 11g, how to change the order of the results of a sql without “order by”?(转)
- How to get the query statement of LOV in Oracle Form
- Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
- Announcing a preview of F# 4.0 and the Visual F# Tools in VS 2015
- What is the difference between SVD and matrix factorization in context of recommendation engine?
- The Excel Connection Manager is not supported in the 64-bit version of SSIS, as no OLE DB provider i 推荐
- Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection