Sql-server – Find when a specific database went offline and the reason for same

sql serversql-server-2008-r2

Find when a specific database went offline and the reason for same and when did it recover back.

All I know there is a SCOM alert set for the server and I got a notification as Database is offline and later when I checked I found it as online. So, I want to check at what time it went offline and how and when did it come online?

Best Answer

At minimum, please check sql logs, for example, if I purposely take a db offline using

alter database [TestDB] set offline with rollback immediate;

I can see in SQL Server log, the following message

Date 10/24/2016 12:28:57 PM Log SQL Server (Current - 10/24/2016 12:00:00 AM)

Source spid51

Message Setting database option OFFLINE to ON for database 'TestDB'.