------------ Query the SQL Server service start time

Source: Internet
Author: User

Create Table # errorlog (logdate datetime, processinfo varchar (max), text nvarchar (max ))
Insert into # errorlog exec master .. xp_readerrorlog
Select logdate from # errorlog where text like '% SQL Server is starting %'
Drop table # errorlog

 

Select crdate time_restart, getdate () as time_now,
Datediff (MI, crdate, getdate () as minutes_since_restart,
@ Cpu_busy/15000.0 as minutes_cpu_busy,
@ Io_busy/15000.0 as minutes_io_busy,
@ Idle/15000.0 as minutes_idle,
(@ Cpu_busy + @ io_busy + @ idle)/15000.0 as minutes_since_restart2,
@ Connections as connections
From master.. sysdatabases
Where name = 'tempdb'

 

-- SQL Server 2008 special method
Select sqlserver_start_time, * From SYS. dm_ OS _sys_info

 

 

Today, I saw them asking this question in the group, and I knew the third one. The first two were perfect uncles who asked me to worship them here.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.