SQL Clone
SQLServerCentral is supported by Redgate
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 "dba@your_company.com" 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: 419 | Views in the last 30 days: 3
Related Articles

Database Snapshot Create/Drop/Restore SQL Script.

Database Snapshot Creat/Drop/Restore SQL Script for Single or multiple data files of databases.


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