top of page
Writer's pictureMadeira Team

Creating AlwaysOn Availability Group With Scripts

Updated: Jul 8, 2020

One day, your Availability Group cluster can get into a critical state in a way that forces your team to create the Availability Group from scratch.

The following scripts can save you’re A$$ and for sure, save a lot of time.

Always be ready!

All you need to do is to fill in the appropriate places your objects names, IP, backup path etc.  (Use the checklist – 00)

Notice that the scripts create the Availability Group and not the Windows Cluster. That needs to be already set up and must include all the Cluster Resources based on your environment (quorum, file share, network, servers). It’s also a good idea to first take a backup of the cluster configuration, using the windows backup feature.

The following steps and AlwaysOnScripts will create the Availability Group from scratch:

  1. Create Mirroring Endpoint.

  2. Restore your database\s to the Primary from backup file.

  3. Create The Availability Groups And a Listener on the Primary.

  4. Join The secondary replica to the Availability Groups.

  5. Take Full Backup for your Primary database\s.

  6. Restore the FULL backup in the Secondary With NORECOVERY mode.

  7. From the Primary, Take Log Backup for your database\s

  8. Restore The Log Backups in the Secondary With NORECOVERY mode.

  9. Join The Database\s in the Secondary To The Availability Group.

Now we’ll all be AlwaysOn.

1 comment

Recent Posts

See All

1 Comment


Eitan Blumin
Eitan Blumin
Jun 17, 2020

The download link for the script appears to be broken.

But no worries, it's available in our Madeira Toolbox repository on GitHub:


https://github.com/MadeiraData/MadeiraToolbox/blob/master/High%20Availability%20Solutions/Availability%20Group%20Setup%20Script.sql

Like

STAY IN TOUCH

Get New posts delivered straight to your inbox

Thank you for subscribing!

bottom of page