0% found this document useful (0 votes)
59 views26 pages

Always On AG Scenarios

Uploaded by

a3073686
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views26 pages

Always On AG Scenarios

Uploaded by

a3073686
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Always on AG Scenarios

Database backup and restore by automatic seeding method.

Database fullbackup and restore taken by us manually


Data synchronization by join only method

2.FAILOVER SCENARIO

Steps to take before taking a failover cluster


1. take full backup and tlog backup
2.Both the SR1 and PR must be running in synchronous availability
mode.
Failover can be done in three ways
1.Directly from Availability group(Graphical way)
2.From cluadmin.msc
3.command based

Command based failover


Manual failover

Forced failover

Failover done successfully


Cluadmin.msc
go to roles and change from SR1 TO PR

Adding and removing a database


Adding
After adding a database the DB will be synchronized state

After adding DB in PR the DB on SR1 will be on restoring state

AGDB34 successfully added


After removing database the dB will be in normal state then refresh the data will
be gone
Adding a file to an existing database
Remove AGDB2 FROM Availbility group the DBs will be in not
connected in state

After connecting
AVAILABILITY REPLICA NOT JOINED WE HAVE TO JOIN IT MANUALLY

AG REPLICA IN CONNECTED STATE


IN SR1 AG DBs not connected

Enabling database level health detection

In SQL Server Management Studio, connect to your SQL Server database engine.
Using the Object Explorer window, right-click on the Always On High Availability node,
and run the New Availability Group Wizard. Check the Database Level Health Detection
checkbox on the Specify Name page. Then complete the rest of the pages in the
wizard.

2.View the Properties of an existing Availability Group in SQL Server Management


Studio. Connect to your SQL Server. Using the Object Explorer window, expand Always
On High Availability node. Expand Availability Groups. Right-click on the availability
group, and choose Properties. Check the option Database Level Health Detection, then
click OK or Script the change.
Adding a disk to PR1
removed AGDB2

AGDB2 IS IN RRSTORING STATE AFTER


REMOVING
Run the following command with path address
where you kept jaffafile

Now CONNECT AGDB2


File added successfully back again
Performing select operations on the secondary
replica
Adding a listener to a AG
Adding a listener on clustering
CONFIGURING READ ONLY ROUTING

Added AGlisten1
Connect to the server instance that hosts the primary replica and in additional
connection parameters type the following command

Change the marked option from YES to READBLE MODE


Adding url address

After that run the below command to know in which


server it is participating
Creation of Load balancer in Azure

CONFIGURING LOADBALANCER AND LISTENER


IN AZURE
Steps
1.Create the availability group listener on the failover cluster.

2.Bring the listener online.

The availability group listener is an IP address and network name that the SQL Server
availability group listens on. To create the availability group listener:

Get the name of the cluster network resource:


a. Use RDP to connect to the Azure virtual machine that hosts the primary replica.
b. Open Failover Cluster Manager.
c. Select the Networks node, and note the cluster network name. Use this name in the
$ClusterNetworkName variable in the PowerShell script.
step2
Add the client access point. The client access point is the network name that
applications use to connect to the databases in an availability group.

a. In Failover Cluster Manager, expand the cluster name, and then select Roles.

b. On the Roles pane, right-click the availability group name, and then select Add
Resource > Client Access Point.

Configure the IP resource for the availability group

Run the below powershell command in powershell


$ClusterNetworkName =
"<MyClusterNetworkName>" # The cluster network
name. Use Get-ClusterNetwork on Windows Server
2012 or later to find the name.
$IPResourceName = "<IPResourceName>" # The
IP address resource name.
$ListenerILBIP = "<n.n.n.n>" # The IP address of the
internal load balancer. This is the static IP address
for the load balancer that you configured in the
Azure portal.
[int]$ListenerProbePort = <nnnnn>

Import-Module FailoverClusters

Get-ClusterResource $IPResourceName |
Set-ClusterParameter -Multiple
@{"Address"="$ListenerILBIP";"ProbePort"=$Listen
erProbePort;"SubnetMask"="255.255.255.255";"Net
work"="$ClusterNetworkName";"EnableDhcp"=0}

Make sure the listener and Load balancer has the


same ip
Before configuring it shows same server name to
which the instance connected

After configuring we can connect to listener from SR1 also


by bringing back IP and AG1 in cluster we can check for
the status of listener.
Configuring backups for databases
participating in AG
Backups taken in PR

BACKUPS TAKEN IN SR1


We need to add WITHCOPY_ONLY to the command for full backup in
secondary replica
We have to download ola hallengren backup
commands and run this in primary and secondary
replica

In jobs run the userdatabases fullback job at step


In primary replica go to jobs and go to properties and
edit the command by adding copyonly and parse the
command and click ok

After running the job from step by step we can see


the full backup coming in primary
After running the job from step by step we can see
the full backup coming in secondary we can see the
backups coming in secondary replica too

Conclusion
So we can see backups in both the places in
Primary and secondary replica.

You might also like