1 2 Previous Next 15 Replies Latest reply: Feb 4, 2014 10:38 PM by Vivek Rana RSS

Server processes and sessions.

Vivek Rana Newbie
Currently Being Moderated

Suppose we are running a dedicated server architecture .

 

Now we can have 0 or many sessions per connection on an oracle database .how will server process relate to multiple sessions over a single connections in a dedicated server architecture?

 

is there going to be a new server process per new sessions or a single server process servicing one connection?

  • 1. Re: Server processes and sessions.
    Baris Yildirim Guru
    Currently Being Moderated

    Hi,

    I am not sure I understand but I can say this

     

    connection=session

     

    and in dedicated server, each client session has one dedicated server process.

     

    Regards

  • 2. Re: Server processes and sessions.
    Vivek Rana Newbie
    Currently Being Moderated

    hi Thank you for the quick reply

    Following are the excerpt from oracle documentation

     

    In dedicated server connections, the database creates a server process on behalf of each connection. Only the client process that causes the dedicated server to be created uses it. In a shared server connection, many client processes access a single shared server process.

     

    Now according to this documentation a server process is created per new CONNECTION so does it mean that session created over the same connection will share the server process to do all their work?

  • 3. Re: Server processes and sessions.
    Baris Yildirim Guru
    Currently Being Moderated

    Hi,

    you're welcome

     

    yes, you are right

     

    Regards

  • 4. Re: Server processes and sessions.
    Vivek Rana Newbie
    Currently Being Moderated

    So even in Dedicated server architecture sessions over the same connection share the server process?

  • 5. Re: Server processes and sessions.
    Harmandeep Singh Journeyer
    Currently Being Moderated

    There is "session" over the connection and not "sessions". This "session" is same which started the connection.

     

    Thanks,

    Harman

  • 6. Re: Server processes and sessions.
    Baris Yildirim Guru
    Currently Being Moderated

    Hi,

    There is no connection concept in Oracle.

     

    you can think connection and session is the same thing.

     

    There are sessions and server processes. A dedicated server process only services a client session.

     

    Regards

  • 7. Re: Server processes and sessions.
    Vivek Rana Newbie
    Currently Being Moderated

    But oracle doc specifies that there can be multiple sessions over the same connections i have no doubt that this is true

     

    but i am just trying to understand the usability of server processes in context to session and connections

  • 8. Re: Server processes and sessions.
    trajon Newbie
    Currently Being Moderated

    Hi

    1 connection can be 1 server process Unix (or thread in Windows) can be (0 or 1 or more sessions)

    Example T.Kyte is illustrate this:

     

    set autotrace on statistics

     

    select username, sid, serial#, server, paddr, status

    from v$session

    where username = USER;

     

    USERNAME SID  SERIAL# SERVER    PADDR STATUS

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

    OPS$TKYTE   30     5476 DEDICATED 32BC2B84 INACTIVE

    OPS$TKYTE   49      225 DEDICATED 32BC2B84 ACTIVE

     

    Statistics

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

            0 recursive calls

            0 db block gets

            0 consistent gets

            0 physical reads

            0 redo size

          831 bytes sent via SQL*Net to client

          419 bytes received via SQL*Net from client

            2 SQL*Net roundtrips to/from client

            0 sorts (memory)

            0 sorts (disk)

            2 rows processed

     

    set autotrace off

  • 9. Re: Server processes and sessions.
    Baris Yildirim Guru
    Currently Being Moderated

    Hi,

    I think it's true for parallel executions. in parallel execution,for example you are running a query wtih parallel hint, you can see in v$session more than one session and of course each session has a dedicated server process.

     

    it says "can be" so possibility

     

    Regards

     

    But oracle doc specifies that there can be multiple sessions over the same connections i have no doubt that this is true
  • 10. Re: Server processes and sessions.
    Vivek Rana Newbie
    Currently Being Moderated

    Hi trajon thank you for the reply

     

    Why do use the keyword maybe ?

     

    And a connection will be a connection and session will be session regardless of what platform you are running the database on.

     

    Did i get it right?

     

    Appreciate the answer

  • 12. Re: Server processes and sessions.
    Suntrupth Expert
    Currently Being Moderated

    Excerpt from Tom Kyte's Expert Oracle Database Archictecture book:

     

     

     

    In Oracle, a connection is simply a physical circuit between your client process and the database instance—a network connection, most commonly. The connection may be to a dedicated server process or to a dispatcher. As previously stated, a connection may have zero or more sessions, meaning that a connection may exist with no corresponding sessions. Additionally, a session may or may not have a connection. Using advanced Oracle Net features such as connection pooling, a physical connection may be dropped by a client, leaving the session intact (but idle). When the client wants to perform some operation in that session, it would reestablish the physical connection

     

     

     

    Connection: A connection is a physical path from a client to an Oracle instance. A connection is established either over a network or over an IPC mechanism. A connection is typically between a client process and either a dedicated server or a dispatcher (Shared Server)

     

     

     

    Session: A session is a logical entity that exists in the instance. It is your session state, or a collection of data structures in memory that represents your unique session. It is what would come first to most people’s minds when thinking of a database connection. It is your session on the server, where you execute SQL, commit transactions, and run stored procedures.

     

    Regards,

    Suntrupth

  • 13. Re: Server processes and sessions.
    BillyVerreynne Oracle ACE
    Currently Being Moderated

    Vivek Rana wrote:

     

    Suppose we are running a dedicated server architecture .

     

    Now we can have 0 or many sessions per connection on an oracle database .how will server process relate to multiple sessions over a single connections in a dedicated server architecture?

     

    is there going to be a new server process per new sessions or a single server process servicing one connection?

     

    Assuming standard client-server over TCP.

     

    Client (via Oracle driver)  connects to Listener and provides a TNS connection string to the Listener.

     

    The Listener resolves that (it has a list of registered SIDs and services and service types) and hands off the client connection to a server process to service.

     

    For a dedicated session request, the Listener starts a server (oracle) process and hands over the client TCP connection to this process. This server process joins the database instance.  It exists solely for servicing that client session. It will terminate (unload from kernel and memory) when the client closes the session. It cannot service any other session.

     

    For a shared server session request, the Listener contacts the Dispatcher process of the database instance, and hands over the client TCP connection to this process.

     

    The Dispatcher now serves as the communication layer between the client and the database. When it receives a client request, it places that on a virtual circuit. The client request is then picked up by an idle shared server process (from the shared server pool). It processes the request.  It places the results back on the virtual circuit. The Dispatcher sends the results to client.

     

    In this architecture, the Dispatcher owns the TCP socket handle to communicate with the client. The client's requests can be serviced by any idle shared server process. A single shared server can service bits and pieces of many different client sessions over time.

     

    This also means that the client session's state data needs to  be global as different shared processes can service that session. The session state (UGA) thus reside in the SGA - unlike dedicated server where it resides in the private process memory (PGA) of the dedicated server process.

     

    BTW, the dispatcher processes open their own TCP endpoints. This means that a client can connect directly to a Dispatcher and bypass the Listener completely. However, dispatcher ports are by default in the private port range, semi-random, and likely firewalled.

  • 14. Re: Server processes and sessions.
    Hemant K Chitale Oracle ACE
    Currently Being Moderated

    >oracle doc specifies that there can be multiple sessions over the same connections i have no doubt that this is true

    Yes. For example, when you have a sqlplus connection to a database in dedicated server session, you will see one session in v$session and one process in v$process.  However, if you issue a SET AUTOTRACE ON in the same connection, you will see *two* sessions in v$session but still one process in v$process.

     

    Setting tracing on in a session creates a new session over the same connection.

     

    Hemant K Chitale

1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points