Thursday, September 6, 2012

Finding the modification date of an Oracle table

So a change has been applied to your Oracle database by your somewhat secretive database administrator or vendor--and you would like to know which tables/views to keep an eye on--but how?

Never fear... there is a query for that...

select * from all_objects

You are looking for a column called last_ddl_time. THAT is the last date that the item was modified. The created column is... well... the day the item was created. The timestamp column is the long form of this creation date

To see all the tables that have been modified simply type:
select * from all_objects where object_type='TABLE'

Similarly, to see all the views the query would be
select * from all_objects where object_type='TABLE'

And if we wanted to narrow the query down further to see the exact changes to the database from our database administrator, we might try something like this:

select * from all_objects where last_ddl>=(sysdate-1)

Trust me--copy this post out and save it... you will end up needing it...