In this Article, let’s take a look at different ways we can check the date and time SQL Server was started last time. There are multiple ways to do it and each of them has its pros and cons.
The first method we shall look is to see when was the TempDB created.
If you recollect, one of the first things you have learned about TempDB is that it is a database used to store objects temporarily and is refreshed/ recreated every time SQL Server is started. Here we would use the creation time of TempDB to determine when
was the SQL Server started last time. To do this, open SQL Server Management Studio, go to object explorer, expand databases node/folder. Expand System databases and right-click on Tempdb as shown below and choose properties. This way of finding information from Tempdb creation is the easiest
way I feel. This step is SQL
Server Error Log Another way of finding the same information is from the SQL Server
Error Logs. This is also one of the easier ways of finding the SQL Server start time, but can be tricky sometimes, which I shall explain in a while.. First let’s take a look at the steps to perform this task. In
object explorer, expand the Management node and find SQL Server Logs. Right click on SQL Server Logs and go to View –> SQL Server Log (as shown below). These SQL Server Logs contain very important information regarding that SQL Server. Every time SQL Server
is started, entries are written in the SQL Server Log. Windows event Logs The next method to find the SQL Server start time is finding
it through the Windows Event log viewer. Explaining the details of how to open a event log viewer (with pictures) is beyond the scope
of this blog. So let me give tell you in short steps. Right-click your computer and choose manage. Under System Tools, expand Event Viewer, choose Windows Logs. Once you are in Windows Logs, choose Windows event Logs Application.
The main section of the console displays the events from various applications installed on your server. A SQL Server startup information is displayed as a shown below. The main problem of finding the SQL Server startup information this way is difficult, since
you have to go through th list of events.. Since I am aware of the startup time, I could go straight to that date and time in the application log. This is another way and the most easiest way to find the SQL
Server start time and date. The information is readily available by querying the dynamic management view sys.dm_os_sys_info.
The column name is sqlserver_start_time. This
dmv has been there since SQL Server 2005, but the column sqlserver_start_time is added starting from SQL Server 2008. -- Bru MedishettyHow to Find the Last Time SQL Server was Started
Database properties window of Tempdb is displayed. In the very first screen when the General page is selected you can notice the Date Created column (highlighted below)…
It looks like you could find the startup information in SQL Error Log easily, but in some cases it might not be that way. Every time a database backup is performed, there is an entry in the SQL Server Error Log which on an SQL Instance with multiple databases
will result in a large number of entries and it would make it difficult to find this information easily. Also, in some cases the Error Log would be regularly recycled in order to ensure that it is easier to read the Error Log and once the maximum number of
Error Logs are reached, SQL Server disposes the oldest Error Log when it has to create a new one.
sys.dm_os_sys_info
Dynamic Management View
Summarizing the blog, looking at the Tempdb create time is an option you can choose no matter what SQL Server version you are using. In case of SQL Server 2008 or above, querying the dmv mentioned above is the easiest way to go…