SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

SQL 2005 Disaster Recovery Scripts: To Setup and Remove Mirroring

By Farhan Sabzaali, 2009/04/08

Total article views: 800 | Views in the last 30 days: 64

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

By Farhan Sabzaali, 2009/04/08

Total article views: 800 | Views in the last 30 days: 64
Your response
 
 
Related tags
 
 
Contribute
Like this? Try these...

Comparing Stored Procedures, Part 5

By Jesse McLain | Category: T-SQL
(not yet rated) | 918 reads

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com