This is, or will be, a loose collection of scripts and routines.
The first is snapper.pl, a Perl script built from Tanel Poder's session snapper sql. The reason I went to the trouble of writing it as a perl script is that when I eagerly tried to use it in a database of a client of mine I got rudely stopped by an "ORA-01031 insufficient privileges" error on the dbms_lock.sleep line. Rather than asking the dbas to grant my id execute on the package I decided to try my hand in recasting Tanel's idea as a Perl script. The above is the result. Execute the script without any parameters to get the usage instructions.
I do not claim to be Perl programmer, so please be gentle. Corrections and suggestions for improvements are welcome.
I already had the first comments by Tanel. I fixed (I hope) a problem with incorrect
output. The other point Tanel made was that in the original version the password
was exposed in the command line. I changed this version to do the same what I do
with my other perl scripts: they get the password from an associative array of logon ids, e.g. %pwd=('SCOTT'=>'tiger');
You can then tuck away that array in a "require" file where no-one else can read
it (see the comments in the code).
If the logon id is not in the array the password will be prompted for.
Those who have already downloaded the script, I just ( Jan 2 2008, 5pm MST ) uploaded an updated version. The prior version didn't do a proper delta on "WAIT" type statistics.
It has come to my attention that downloading the script is somewhat of a
challenge if you use the Microsoft IE browser.
One solution is to switch to firefox ;-)
But seriously, to download the script you need to right-click on the link and select "save target as ...". IE will save it as snapper.htm but it is really the Perl script. You can execute it like that with "perl snapper.htm ..." but I would probably rename it to snapper.pl.
The deltas were still not correct. I hope it's finally fixed - 2008-02-19.