• About

sqlerrors

~ From the errors of others, a wise man corrects his own

sqlerrors

Tag Archives: sql server restart

Find Windows and SQL Server Last Restart time

26 Tuesday Nov 2013

Posted by Praveen D'sa in SQL Server

≈ Leave a comment

Tags

sp_readerrorlog, SQL DMV, SQL Server, SQL Server last restart, sql server restart

As a routine DBA activity I was analyzing sp_readerrorlog this morning and surprised to see that SQL Server has restarted early this morning.

Here are few different ways that you can make use of to tell when SQL Server was last restarted.

Method 1: 

sp_readerrorlog 0,1,'Copyright (c)'
sp_readerrorlog

Method 2:

SELECT sqlserver_start_time FROM sys.dm_os_sys_info

sqlserver_start_time
———————–
2013-11-26 01:16:10.757

(1 row(s) affected)

Method 3:

SELECT login_time FROM sys.dm_exec_sessions WHERE session_id = 1

login_time
———————–
2013-11-26 01:16:24.127

(1 row(s) affected)

Method 4: 

SELECT create_date FROM sys.databases WHERE name = 'tempdb'

create_date
———————–
2013-11-26 01:16:13.023

(1 row(s) affected)

Method 5:

Right click on the server name in SSMS and select Reports > Standard Reports > Server Dashboard and you will get a report similar to below report.

dashboard_report

Method 6: 

start -> run -> eventvwr

Chose Windows log -> Application
Open filter and enter Event Sources (MSSQLSERVER) and Event Id (17163)
eventviewer

Here is the output of above filter.
eventviewer_result

 

Here are a few different ways that you can tell when Windows last rebooted.

Method 1:

Start Task Manager->Performance
Screen below gives you total up time since last restart.
taskmanager

Method 2:

start -> run -> eventvwr
Choose: Windows Log – > System
Open filter and following Event Id’s
6005 to see when the Event Log service was started. It gives the message “The Event log service was started“.
6006 to see when there was a clean shutdown. It gives the message “The Event log service was stopped“.
6008 to see when there was a dirty shutdown. It gives the message “The previous system shutdown at time on date was unexpected“.
6009 is logged during every boot.

server_restart

Here is the output of above filter.
server_restart_result

Hope this helps!

Share this:

  • More
  • Email
  • Print

Like this:

Like Loading...

Recent Posts

  • What’s wrong with this query? July 30, 2015

Categories

  • Learning (2)
  • MS SQL Tips (3)
  • Performance Tuning (1)
  • SQL Script (5)
  • SQL Server (14)
    • Index (1)
    • Log Shipping (1)
  • SQL Tips & Tricks (1)
  • Uncategorized (5)

Archives

  • July 2015 (2)
  • February 2015 (1)
  • October 2014 (2)
  • September 2014 (1)
  • May 2014 (1)
  • April 2014 (3)
  • March 2014 (2)
  • February 2014 (2)
  • January 2014 (1)
  • December 2013 (3)
  • November 2013 (9)

sqlerrors

sqlerrors

Disclaimer:

This is my personal blog. The opinions & suggestions expressed here are
my own. For accuracy and official references please refer to MSDN,Microsoft TechNet,
Books Online. I do not endorse any of the tools / applications / books / concepts
mentioned here on my blog. I have simply documented my personal experiences on this
blog.

Create a free website or blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • sqlerrors
    • Join 225 other followers
    • Already have a WordPress.com account? Log in now.
    • sqlerrors
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

    %d bloggers like this: