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

Testing the Availability Group failover


In this recipe, we will failover our availability group to our secondary replica.

Getting ready

To follow this recipe, your AlwaysOn availability group should already be set up and the primary/secondary replicas should be functional. If it's not yet set up, you can use the previous recipes in this chapter to set up your AlwaysOn availability group.

In this recipe, we will failover from the primary replica (SQL01) to our secondary replica (SQL02). Before doing this, let's visually check whether the availability group looks like SQL02. Open SQL Server Management Studio and go to the AlwaysOn High Availability node. Here is what SQL02 looks like:

Notice that beside the SQLAG availability group name is the indicator (Secondary). This should change to Primary after we failover.

How to do it...

The following steps show you how to failover an Availability Group:

  1. Log in to the secondary replica that you want to failover to. In this recipe, it's SQL02.

  2. Open PowerShell...