Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Monitoring SQL Server downtime

By Yul Wasserman,

The following script creates a monitoring utility to find out for how long a sql server was down prior to the latest startup.
The script creates one table (tblHeartbeat), four stored procedures (uspFillHeartBeat, uspGetDowntimeSummary, uspCleanHeartbeat, uspAtStartup) and two jobs (FillHeartbeat and CleanHeartbeat).
1. By convention I introduced in my company (UGO Networks, Inc.) all "service" database objects except uspAtStartup
are created in a dedicated database called DBAservice.
2. uspAtStartup is created in master database. It must be in master in order to set up the startup option.
Note that user name "DBA" and email address "" in the text of uspAtStartup
are to be substituted with real ones.
3. The "create job" section of the script is provided just for "completeness of the picture" and can be omitted as trivial. This task can be accomplished in Enterprise Manager.
The jobs FillHeartBeat (runs once a minute in my environment) executes uspFillHeartBeat,
and the job CleanHeartbeat (runs once a week in my environment) executes uspCleanHeartbeat.

Total article views: 399 | Views in the last 30 days: 2
Related Articles

script to create indexes existing in a database

script to create indexes existing in a database


A Script A Day - Day 6 - Drop and Create Database Snapshots

Today's Script will drop all database snapshots and create a database snapshot for all online read w...


Create Login Script

Error with Create Login Script


Create Database

Create database taking forever


Script difference between two databases

Compare two databases and create script to use to update one database


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones