Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Reading from V$ACTIVE_SESSION_HISTORY

3047549Jan 27 2017 — edited Jan 28 2017

Hi,

I would like to scan V$ACTIVE_SESSION_HISTORY periodically, every time for some short period of time, but to be sure that I havent miss any row between two readings

Something like the following snippet:

while(true)

     ReadSomeLastMinutes();

     DoProcessing()

     wait X minutes

I am just not sure how to read from where I have stopped last time, and to be sure that I havent miss any row.

It is not a problem if I read some rows twice..I can handle it.....it is only important that all samples are read..at least once

Now the question, regarding the filter:

1. if in one reading ( ReadLastMinutes() ) I detect that, max sample_date, over all sessions, was for example : 22h 10min 15sec..... Can I then assume that is safe to read next time from sample_date >= 22h 10min 15sec 000. In other words, can I assume that , if at least for one session sample for 22h 10min 15sec was available, that then , for sure, all samples for <=22h 10min 14 sec, for all sessions are already there  ?  Or in other words, I hope that it is not possible that session1 has already sample for 22h 10min 15sec there, and that, after that, later, session2 gets sample for 22h 10min 14 sec ?

2. It would be easier for me to use SAMPLE_ID, but soon or later it will be somehow reset I suppose....so, I assume that something like 'remember max sample_id and then next time read sample_id > max' would not work, on the long run ?

3. Any other suggestion

thx

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 25 2017
Added on Jan 27 2017
2 comments
562 views