* Description: Checking and killing session count by time frame
* Compatiablity: RDBMS 11g, 12c
* Date: 03:58 PM EST, 03/27/2017

<1> Session status:
     |__ ACTIVE: session currently executing SQL.
         INACTIVE: session is not executing SQL.
         KILLED: Session marked to be killed.
<2> Session id and serial#: 
     |__ SID: Session identifier
         SERIAL#: As Oracle setting up, maxmium session allowed count will be limited by parameter. So, session id will be recycled to use.
                  When one session got terminated, a new session may use the same sid. For this case, serial# - which is a forever increased number, got introduced to ensure
                  the combination of SID+SERIAL# can address one identical session.

<3> Username is NULL:
     |__ In v$session, if username is null, it means the session got connected by Oracle background process.
<4> Oracle database client session initialized steps:
     |__ a. Client on remote server side sends over an NSPTCN packet to get connect with listener. [ client------request-------> listener ]
         b. Listener will initiate a dedicated database process to receive the connection. [ listener-------request------>DB process ]
         c. After the dedicate database process started, the listener will hand over the connection request from client to the database process.
         d. The server process will take over the connection from the listener to continue the handshake with the client. 
         e. Server process and client exchange information required for establishing a session. [ such as log on authentication info ]
         f. Finally, we can call it "a session got established".


Your Comments