Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By : Donabel Santos
Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By: Donabel Santos

Overview of this book

Table of Contents (21 chapters)
SQL Server 2014 with PowerShell v5 Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Joining the secondary replicas to Availability Group


In this recipe, we will join the secondary replicas to an existing Availability Group.

Getting ready

Before we proceed with this recipe, the availability group needs to be created. Let's take a look at the Creating an AlwaysOn Availability Group recipe.

As documented on MSDN, the prerequisites to join the secondary replicas are as follows:

  • The primary replica should be online

  • The join command to join the secondary replicas to the availability group needs to take place at the secondary server instance that hosts the secondary replicas

  • The secondary instance must be able to connect to the database mirroring endpoint of the primary instance

Since we need to execute the command on the secondary instances, we can use PowerShell remoting to send the command to the remote hosts. Ensure that PSRemoting is turned on in every node. If PSRemoting is disabled, log in to each of the nodes, launch PowerShell or PowerShell ISE as an administrator, and enable...