Find Start Time of SQL Server
One of the Server Standard Reports shows the SQL Server instance startup time:
Connect to SQL Server Instance -> Right Click on instance name -> Click Reports -> Click Standard Reports -> Choose Server Dashboard Report:
For details what other Standars Reports are there in SQL Server and how to open them, read previous blog post:
Standard Reports in SQL Server Management Studio
In Windows Event Viewer you can find the startup time of SQL Server service. Filter the Aplication Event Sources by instance name, and Event ID 17162:
To find out the SQL Server instance start time in the current SQL Server error log in SQL Server Management Studio:
Management -> SQL Server Logs
Find the “SQL Server is starting” line at the bottom of the log. If the log was cycled, open previous logs until you find the SQL Server start time:
You can query sys.dm_exec_sessions Dynamic Management View that shows information about all active connections and find out the login time of the Session Id 1, that is created when the SQL Server is started:
SELECT login_time
FROM sys.dm_exec_sessions WHERE session_id=1
The tempdb system database is re-created every time SQL Server starts, so by finding out the creation time of tempdb, you can find out the start time of SQL Server instance (database ID of tempdb database is always 2):
SELECT create_date
FROM sys.databases where database_id=2
If the Default Trace is not explicitly disabled on your SQL Server instance, you can find out the start time of SQL Server instance by finding out the start time of the Default Trace, because the Default Trace is started when the SQL Server is started:
SELECT start_time FROM sys.traces
WHERE is_default = 1
In SQL Server 2008 and SQL Server 2012 you can query sys.dm_os_sys_info Dynamic Management View, but it requires VIEW SERVER STATE permission on the server:
SELECT sqlserver_start_time
FROM sys.dm_os_sys_info
There is a small time difference between the results, depending on the method you used to determine the SQL Server start time.
No comments:
Post a Comment