I am trying to find when the last time a database has been restored. We have several SQL servers. I have formed the following query based on an article I found. It worked great on the first one I tried, but wasn't recent enough. When I tried to go to other servers looking for a more recent version, I found there were no records at all in the RESTOREHISTORY table. I had been logged in to each as sa, so I don't believe its a permissions problem.
Is there a way that someone can prevent the record from being written when they restore? How can these databases exists with thousands of records without having been restored?
USE MSDB GO SELECT TOP 1 * FROM RESTOREHISTORY WITH (nolock) WHERE (DESTINATION_DATABASE_NAME = 'RKDB') ORDER BY RESTORE_DATE DESC