After seeing Kyle Hailey’s ashmasters GitHub repository (with all kinds of interesting scripts), I thought I might give it a try and start my own repository on GitHub. I blogged about some of my scripts before, but storing these on my domain was kind of unfriendly, because if I stored them as a .sql file, it assumed the file was a SQLite database.
So now you can find my ever growing Oracle performance script repository on GitHub: https://github.com/Marcel-Jan/oracle_performance
I’ve already added several scripts. One of which, is sql_old_hash.sql. It’s a script to retrieve information about a SQL statement, based on the old hash value found in Statspack. It retrieves about the same information as sql_sql_id.sql does.
So now you can run a Statspack report, check the SQL statement with the most elapsed time in the “SQL ordered by Elapsed time for DB” section (or ordered by CPU, gets, reads, executions, etc.), check the Old Hash Value column. Then run this script, enter the old hash value, choose a child number that seems appropriate and out comes about everything you might want to know. I didn’t have an Oracle database with Statspack handy to test it. I think it works all right, since I copied a lot of working code from sql_sql_id.sql and replaced sql_id’s for hash_value’s in the where clauses, but let me know.