Setup fresh/Scriptout Existing Mirroring on SQL Server

Spread the love

In my current organization, we have lot of servers where database mirroring is used as a disaster recovery option. Either we are setting up mirroring from scratch or dropping the existing mirroring and re-establishing it, it is going to take from 30 min to an hour. So in order to reduce the overall mirroring setup time, I have created below script that will provide TSQL Code to create database mirroring from scratch or will script out existing mirroring setup on server. Scripting out existing setup can be useful in cases where we need database refresh from other environments.

Code to Scripout Existing Mirroring on SQL Server

Sample result from above query is as below:-

Friends, please try the script, and let me know of any bugs by comments. If you like the article, do Like & Share. Happy Coding 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.