Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Professional SQL Server High Availability and Disaster Recovery

You're reading from   Professional SQL Server High Availability and Disaster Recovery Implement tried-and-true high availability and disaster recovery solutions with SQL Server

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher Packt
ISBN-13 9781789802597
Length 564 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Ahmad Osama Ahmad Osama
Author Profile Icon Ahmad Osama
Ahmad Osama
Arrow right icon
View More author details
Toc

Table of Contents (24) Chapters Close

About the Book
About the Authors
Objectives
Audience
Approach
Hardware Requirements
Software Requirements
Conventions
Installation
Installing the Code Bundle
Additional Resources
1. Lesson 1 FREE CHAPTER
2. Getting Started with SQL Server HA and DR 3. Lesson 2
4. Transactional Replication 5. Lesson 3
6. Monitoring Transactional Replication 7. Lesson 4
8. AlwaysOn Availability Groups 9. Lesson 5
10. Managing AlwaysOn Availability Groups 11. Lesson 6
12. Configuring and Managing Log Shipping 1. Appendix

Lesson 5: Managing AlwaysOn Availability Groups

Activity 5: Manual Failover

Solution:

  1. Execute the following query to failover from DPLPR to DPLHA:

    :Connect DPLHA

    ALTER AVAILABILITY GROUP [DPLAG] FAILOVER;

  2. Execute the following query on DPLHA to verify that the failover is complete:

    SELECT

    ag.name AS AvailabilityGroup,

    ar.replica_server_name AS ReplicaName,

    ars.role_desc AS Role,

    ars.operational_state_desc

    FROM

    sys.availability_groups ag join sys.availability_replicas ar

    on ag.group_id=ar.group_id

    join sys.dm_hadr_availability_replica_states ars

    on ar.replica_id=ars.replica_id

    The Role column for the DPLHA replica should state Primary.

  3. To fall back to DPLPR, execute the following query:

    :Connect DPLPR

    ALTER AVAILABILITY GROUP [DPLAG] FAILOVER;

    To verify the failover, execute the query from step 2 once again. The Role column for the DPLPR replica should state Primary.

Activity 6: Adding a New Database to an Existing Availability Group

Solution:

  1. Execute the following query at DPLPR...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images