Is there any way to show how many times the server was restarted this month?
I'm using SQL Server 2008.
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
Well, I think this can help:
you create a table, insert errorLog data inside this tabel and just select it:
create table ErrorLog ( LogDate datetime, ProcessInfo varchar(100), Text varchar(max)) insert into errorlog EXEC sp_readerrorlog select * from errorlog where Year(logdate)='2018' and text like '%Something%'
Or with a count:
select count(*) from errorlog where Year(logdate)='2018' and text like '%backup%'
We just need to use a string that is used during a server restart. Maybe '%Server name is%'. I can see this string on every restart.
Yes, to the extent that does not exceed limits that are set.
In SSMS go to Management > SQL Server Logs
Details are in the logs about what happened, but as a quick references, the date shown on each of the log archives is the last entry as the server was shut down.
This is in no way exclusive or fool proof. there are many variables. But if the oldest Archive has a date 3 months ago, the server has not been shut down since then.
Related Keeping all SQL Server logs