Home > database >  Sessions and the number of connections
Sessions and the number of connections

Time:10-13

1/9


Concept of


Popular speaking, Session (Session) is a communication both sides from the beginning to the end of the communication during a Context (Context), the Context is a located in memory on the server: record the client machine to connect, through which application, which the information such as user login.





Connect (Connection) : Connection from the client to a physical path of ORACLE instance, Connection can be set up on the Internet, or set up in the machine through the IPC mechanism, usually in the client process with a dedicated server or a Connection is established between the scheduler,





Session (Session) was established and the Connection (Connection) is at the same time, the two are descriptions of the same thing different levels, in short, connect (Connection) is the physical client and server communication link, user (Session) is a logical Session with the server communication interaction,





In ORACLE, the premise of a user login ORACLE server is the user has the ORACLE "CREATE SESSION" permissions, ORACE allowed to CREATE multiple with the same user on the same client server SESSION, each SESSION on behalf of the user and the server of a interaction, like garden you use IE browser to open the blog site, and then you could open a window, IE garden and open a blog site, and two Internet explorer window is equivalent to two SESSION, and the physical link is equivalent to connect (Connection), daemons PMON will every once in a while, can detect the user Connection status, if the Connection has been disconnected, PMON will clean up the scene, release the related resources,


In a connection without the corresponding session, in addition, a session can have connection can not connected, using advanced Oracle.net features (such as connection pool), customers can delete a physical connection, the session will still be in place (but session will be free), performed an operation on the customer in this session, it will be to establish a physical connection,


In a dedicated server, a session corresponds to a server Process (Process), if the database is running in a Shared server, a server Process can serve multiple sessions,




Here in a comprehensible way to explain the connection and session,




Have A/B two cities, need from A deliver cabbage to B city


Let's build a highway

2/9

Then shipped cabbage in the past, including preparation for transport of cabbage and Chinese cabbage and return and so on a series of actions,


A highway, can deliver 0 - n cabbage

From A to B, of course, the road could not only one,

One Chinese cabbage, can in the real road opened a path

A ship will not affect other transport state



The corresponding database

On behalf of A client process


B on behalf of the server process
Highway on behalf of the connection,

Carrying a cabbage represents a session


A connection can be multiple session

A session can not rely on a connection, even no connection (when I'm ready, really started to deliver to build connection)

A session will not affect other session




Session & amp; Link


In the specific application scenario for the connection (connction) and session (session) have a lot of situations:


1. The SQL * PLUS login ORACLE


This kind of scenario is more easy to understand, a link corresponding to a Session,


2. Log on to ORACLE PL/SQL Developer tools


PL/SQL Developer tools & gt; Preferences - & gt; Connection, you can set the session, as shown in the figure below:




Select multiple sessions, if set, PL/SQL Developer login ORACLE, every open a window, will create a new session, single session, and set the option to choose the new open window will share a session, specific you can consult PLSQL Developer8.0 user guide:


Multiple session: each test window, Windows and SQL command window will have its own session, another session will be used to compile, it is the most flexible Settings, obviously leads to the largest number of database session, another possible disadvantage is that after the update has been submitted, they are only in the X window you can see, in the Y window can't see,


Duplex session: testing window, Windows and SQL command window will share a session, another session will be used to compile,

3/9

The shortcoming of this model is only one window at a time can run the program,


Single session: all Windows and all compiled using the same session, which make it very difficult to secure the transaction management, debugger is disabled in this mode is used, if you are limited only to use a database session, so you can only use this set,





Session & amp; Process





How to view in the Oracle parameters sessiones or the value of the processes? General use show parameter command to see,


SQL> Show the parameter the processes;



The NAME, TYPE, VALUE

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Aq_tm_processes integer 0

Db_writer_processes integer 1

Gcs_server_processes integer 0

Job_queue_processes integer 10

Log_archive_max_processes integer 2

The processes of integer 850

SQL> Show parameter session;



The NAME, TYPE, VALUE

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Java_max_sessionspace_size integer 0

Java_soft_sessionspace_limit integer 0

License_max_sessions integer 0

License_sessions_warning integer 0

Logmnr_max_persistent_sessions integer 1

Session_cached_cursors integer 20

Session_max_open_files integer 10

Sessions integer 940

Shared_server_sessions integer

SQL>

Method 2: query v $parameter


Select the name, type, value, display_value, isses_modifiable, issys_modifiable

4/9

The from v $parameter

Where name='sessions;





Select the name, type, value, display_value, isses_modifiable, issys_modifiable

The from v $parameter

Where name='the processes;




Method 3: query v $resiyrce_limit;







Relationship between the number of sessions and the processes of Oracle is:


Oracle 11 g R1 and the previous version


Sessions (1.1 * the processes) + 5=


Oracle 11 g R2


Sessions=(1.5 * the processes) + 22


Shown in the example below, in Oracle 10 g version, the processes and the relationship between sessions as follows:


SQL> Select * from v $version;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related