Re: hacking V$MYSTAT into "V$MYSESSION"

From: Sayan Malakshinov <xt.and.r_at_gmail.com>
Date: Sat, 30 Mar 2019 00:41:35 +0300
Message-ID: <CAOVevU4LXZQQR-EcBTwinr_bAPrKscVFCxzzhtcAGXUjqRxTdQ_at_mail.gmail.com>



In case of parallel queries you can have more than 1 session :) Simple example:
declare

   cursor c is select/*+ parallel(4) */ * from all_objects;    crow c%rowtype;
begin

   open c;
   fetch c into crow;
   for r in (select s.sid,s.serial#,px.qcsid,px.qcserial# from v$session s, v$px_session px where s.audsid=userenv('sessionid') and s.sid=px.sid) loop

      dbms_output.put_line('Sid:'|| r.sid ||', serial#:'|| r.serial# ||' qcsid='|| r.qcsid);

   end loop;
end;
/

or another example - just just one simple query: with v as (select/*+ parallel(4) materialize */ count(*) from all_objects) select/*+ parallel(8) */
  px.sid,px.serial#,qcsid,qcserial#
 ,s.*
from v,v$session s, v$px_session px
where

     s.audsid=userenv('sessionid')
 and s.sid=px.sid(+)
 and s.serial#=px.serial#

/

On Fri, Mar 29, 2019 at 10:54 PM Luis Santos <lsantos_at_pobox.com> wrote:

> Sounds reasonable, but V$SESSION is not V$SESSIONS... :-)
>
>
> from mobile
>
> Em sex, 29 de mar de 2019 15:43, Oleksandr Denysenko <odenysenko_at_gmail.com>
> escreveu:
>
>> I think v$mysession is really good for my current session,
>> but v$mysessions is good for all my(current user) sessions.
>>
>> пт, 29 мар. 2019 г., 20:39 Norman Dunbar <oracle_at_dunbar-it.co.uk>:
>>
>>> On 29/03/2019 18:29, Oleksandr Denysenko wrote:> hi.
>>> >
>>> > just re-read requirements
>>> > "(current and possibly other sessions from the same user)"
>>>
>>>
>>> I sit corrected, thank you very much. Apologies.
>>>
>>> Note to self, remember to read the text before jumping in with both feet!
>>>
>>>
>>> Cheers,
>>> Norm.
>>>
>>> --
>>> Norman Dunbar
>>> Dunbar IT Consultants Ltd
>>>
>>> Registered address:
>>> 27a Lidget Hill
>>> Pudsey
>>> West Yorkshire
>>> United Kingdom
>>> LS28 7LG
>>>
>>> Company Number: 05132767
>>> --
>>> http://www.freelists.org/webpage/oracle-l
>>>
>>>
>>>

-- 
Best regards,
Sayan Malakshinov
Oracle performance tuning engineer
Oracle ACE Associate
http://orasql.org

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Mar 29 2019 - 22:41:35 CET

Original text of this message