Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database / SQL-Server

SQL Server Restart Health Check Script

0.00/5 (No votes)
25 Aug 2013Ms-RL 11.2K   214  
Steps for deploying Restart Health Check script in a SQL Server environment.

Prerequisites

  1. DB Mail service needs to be deployed or its deployment script should be present.
  2. Health Check Script does not work on SQL Server 2000
  3. SQL Server names in a SQL table
    1. Get SQL instance name -- for example, SQL2008R2\TEST
    2. Get SQL DB name -- for example, SQLDB
    3. Get SQL table name -- for example, dbo.health_check_server_list
  4. PowerShell tool  for deployment
    1. Preferred tool is POWERGUI Script Editor Tool

Steps to install health check script

  1. Create a folder C:\healthcheck
  2. Copy attached files into above folder
  3. Fill out below details in script db_mail_check.sql.
    1. Profile name
    2. Email address of the account from which you want to send email out from SQL Server
    3. Receiving email address
    4. Mail server address
    5. Email address where you want to receive alert
  4. Fill out below details in script health_check_script_SP.sql
    1. DB mMail profile name
    2. Email address where you want to receive alert
  5. Fill out below details in PowerShell script health_check_powershell_deploy_script.ps1
    1. $sql_instance
    2. $db_name
  6. Open script health_check_powershell_deploy_script.ps1 in PowerGUI script editor
  7. Execute the script using F5 key.

License

This article, along with any associated source code and files, is licensed under Microsoft Reciprocal License