Oracle - timed sampling from v$session_longops
        Posted  
        
            by FrustratedWithFormsDesigner
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by FrustratedWithFormsDesigner
        
        
        
        Published on 2010-04-27T20:49:48Z
        Indexed on 
            2010/04/27
            20:53 UTC
        
        
        Read the original article
        Hit count: 336
        
I am trying to track performance on some procedures that run too slow (and seem to keep getting slower). I am using v$session_longops to track how much work has been done, and I have a query (sofar/((v$session_longops.LAST_UPDATE_TIME-v$session_longops.start_time)*24*60*60)) that tells me the rate at which work is being done.
What I'd like to be able to do is capture the rate at which work is being done and how it changes over time. Right now, I just re-execute the query manually, and then copy/paste to Excel. Not very optimal, especially when the phone rings or something else happens to interrupt my sampling frequency.
Is there a way to have script in SQL*Plus run a query evern n seconds, spool the results to a file, and then continue doing this until the job ends?
(Oracle 10g)
© Stack Overflow or respective owner