When is SQL Server restarted?


It has been a while since last post now due to summer vacation and busy working hours

In my post on simple database activity monitoring, I described a method by calculating periodical values for read  write operations for databases. These values are calculated based on DMVs (Dynamic Management Views) that stored performance counters. The problem is that most of these DMVs is reset when the SQL Service or the server isself is restarted.

Method 1

SELECT login_time FROM sysprocesses WHERE spid = 1

 Method 2

SELECT sqlserver_start_time FROM sys.dm_os_sys_info

 Method 3

SELECT [crdate] AS [LastStartupDate]
FROM [dbo].[sysdatabases]
WHERE [name] ='tempdb'
AND [crdate] < GETDATE()
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s