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
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!