I want to find when the stored procedure was last executed, so that I can delete the unused stored procedures. One way is to scan through the code and find out the list of used stored procedures and delete the unused one’s, since the no of stored procedures is in thousands, I would like to know if there is an option in DB2 to find this easily.
Share
You don’t say what platform or version of DB2 you are using.
If you are running on DB2 for Linux/UNIX/Windows and are on V9.7 or later, you can look at the
LASTUSEDcolumn inSYSCAT.PACKAGES, which can be joined toSYSCAT.PROCEDURESviaSYSCAT.ROUTINEDEP:If a procedure has never been executed, LASTUSED will have the value ’01/01/0001′. The query above filters these out.
Also, please note that you may want to filter on
PROCSCHEMAso you’re not seeing all of the system stored procedures…