Click here to monitor SSC
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)

SQL 2005 Disaster Recovery Scripts: To Setup and Remove Mirroring

By Farhan Sabzaali,

SQL 2005 includes a very easy to use method to setup and remove mirroring using SQL Server Management Studio however, when you are dealing with 30+ databases spread across multiple instances, it becomes tedious to use GUI to setup and remove mirroring.

I have included two scripts that may assist you in performing the task using T-SQL as follows:

1. Setup mirroring: This script generates nine (9) distinct steps using information you provide for a single database - these steps can then be used to save scripts to quickly setup mirroring logic for each database. I have tried to include detailed comments on what each step does and section on what information you need to have available to generate the final script (see script for further details). Note: I have not included piece for Witness.

2. Remove mirroring: This script generates manual failover script for all databases per server \ instance that are mirrored. Note: This does not actually do failover but just generates the script that you can then use to do failover.

Hope this helps you in your day-to-day job function or during disaster recovery exercise. Would love to hear of suggestions to improve these.

Thanks,

Farhan F. Sabzaali

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

Generate scripts for all databases

Generate scripts for all databases

SCRIPT

Database Mirroring Setup Procedure generator

A script that generates all the commands for installing a new database mirroring between two servers...

SCRIPT

Database Mirroring Setup Procedure generator

A script that generates all the commands for installing a new database mirroring between two servers...

FORUM

Database Mirroring

Database Mirroring

ARTICLE

A Standard Database Security Script Generator

A script generator for standard security compliance.

 
Contribute