Please see my other blog for Oracle EBusiness Suite Posts - EBMentors

Search This Blog

Note: All the posts are based on practical approach avoiding lengthy theory. All have been tested on some development servers. Please don’t test any post on production servers until you are sure.

Tuesday, March 15, 2011

Current session wait activity in DB


Create Or Replace Force View Sys.Av_db_cur_sess_wait_activity (Sid,
                                                               Username,
                                                               Wait_class,
                                                               Total_waits,
                                                               Time_waited_secs,
                                                               Killstmt
                                                              )
As
   Select   A.Sid, B.Username, A.Wait_class, A.Total_waits,
            Round ((A.Time_waited / 100), 2) Time_waited_secs,
               'Alter SYSTEM Kill Session '
            || ''''
            || B.Sid
            || ','
            || B.Serial#
            || ''' '
            || 'IMMEDIATE;' Killstmt
       From Sys.V_$session_wait_class A, Sys.V_$session B
      Where B.Sid = A.Sid
        And B.Username Is Not Null
        And A.Wait_class != 'Idle'
   Order By 5 Desc;

No comments: