Database 11g

Thursday, October 29, 2015

How to find Sessions on RAC



> Here we are querying how many business sessions are running in each node from the users.
   we can see here on node1 179 sessions are running and on node2 171 sessions.

> This query is not including SYS or any other  default oracle sessions.


SQL> select inst_id,count(*) from gv$session where username is not null group by inst_id;


             INST_ID      COUNT(*)
            --------- ------------------
                  1                 179
                  2                 181


Querying SESSIONS NODE WISE:-

> You can observer some users are connected to INST_ID 1 which is nothing but node1 and some are connected to INST_ID 2 which nothing but node2.
> Count(*) column contains sessions opened per user some has opened 2 sessions from their application and some are opened 3 , 1 etc...

SQL>  select username,inst_id,count(*) from gv$session where username is not null group by                        username,inst_id order by count(*);

           USERNAME      INST_ID   COUNT(*)
         --------- ---------- ---------------------------------
            RNLUAM              1                 1
            RNAIDA                2                 4
            RNFRSA               2                 2
            RNANME              1                 3
            ADTAYOM            2                 1
            RTHUHA              1                  5
            DRSHMO              2                 2



> In this query we can see only sessions opened by the user

SQL> select username,count(*) from gv$session where username is not null group by username order by count(*);

USERNAME            COUNT(*)
---------------------------------------------
RNJEDI                          5
RNMATA                        2
LABMUHA                      1
DRSHMO                        3
DRAHTA                         1




Happy Learning ...

No comments:

Post a Comment