I have some databases that are not being used. I took snapshots of the databases when I took a backup. I wrote code which looked to see if "rows selected" < 2 and made the assumption that the db was not being used. Does anyone know of a system level view or function that would tell me when a databvase was last used ??
thanks....that does it for the 9.7 db's... I will continue to use my existing code to determine if a db has not been used in the last 6 months...here is the sql I use. I take a database snapshot each time I take a database backup...
db2 -x "select rows_selected,'|', snapshot_timestamp,'|', (CASE WHEN (date(snapshot_timestamp) < current_date-180 days) then '$SERVER|$inst|$db|PotentialDropDB' END) from $inst.database_snapshots where (rows_selected < 2) order by snapshot_
timestamp desc fetch first row only" > kjd.out
In one of our env, they have many databases created. I suspect some are not actually being used. I scheduled "db2 list applications" to see which ones have applications connected. In the test env, I picked the largest db (which I've never seen any applications connected to) and quiesced it. But because some id's have DBADM, I also uncataloged the db.