Contact us

Madeira Data Solutions

Your Data, Our Solutions

Creating AlwaysOn Availability Group With Scripts

Written By: Guy Yaakobovich 09/03/2018

 

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.

Leave a Reply

Your email address will not be published. Required fields are marked *