SessionHistory
Here is another note to myself about how to look at what sessions were doing over time.
The situation was that we saw a lot of blocking sessions during a performance test. The developer wants information about the blocking sessions. To do this we want historical information from v$session, which helpfully tells us the blocking session, and also the SQL being run. This can be sampled every so often using a simple script, but Oracle have already thought about this and created v$active_session_history which you can use if you have licensed the Diagnostics pack.
This dynamic performance view is saved to DBA_HIST_ACTIVE_SESS_HISTORY periodically. So, to see which session is blocking another we can do the following:
We can look at the entries for the blocking session using something like this:
And we can even see what the session is running using the following:
|
|
I notice Arup Nanda did an Oracle Magazine article on this in January 2013.