You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/includes/ss-force-failover-read-scale-out.md
+22-9Lines changed: 22 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Each availability group has only one primary replica. The primary replica allows
9
9
Use this method when the primary replica is not available and can not be recovered. You can find more information about forced failover with data loss at [Perform a Forced Manual Failover](../database-engine/availability-groups/windows/perform-a-forced-manual-failover-of-an-availability-group-sql-server.md).
10
10
11
11
To force fail over with data loss, connect to the SQL instance hosting the target secondary replica and run:
12
-
```Transact-SQL
12
+
```SQL
13
13
ALTER AVAILABILITY GROUP [ag1] FORCE_FAILOVER_ALLOW_DATA_LOSS;
14
14
```
15
15
@@ -21,14 +21,13 @@ The following steps describe how to manually fail over without data loss:
21
21
22
22
1. Make the target secondary replica synchronous commit.
23
23
24
-
```Transact-SQL
24
+
```SQL
25
25
ALTER AVAILABILITY GROUP [ag1] MODIFY REPLICA ON N'**<node2>*' WITH (AVAILABILITY_MODE = SYNCHRONOUS_COMMIT);
This setting ensures that every active transaction is committed to the primary replica and at least one synchronous secondary. The availability group is ready to fail over when the synchronization_state_desc is SYNCHRONIZED and the sequence_number is the same for both primary and target secondary replica. Run this query to check:
28
+
1. Run the following query to identify that active transactions are committed to the primary replica and at least one synchronous secondaryreplica.
30
29
31
-
```Transact-SQL
30
+
```SQL
32
31
SELECTag.name,
33
32
drs.database_id,
34
33
drs.group_id,
@@ -39,16 +38,30 @@ The following steps describe how to manually fail over without data loss:
39
38
WHEREdrs.group_id=ag.group_id;
40
39
```
41
40
41
+
The secondary replica is synchronized when `synchronization_state_desc` is `SYNCHRONIZED`.
The following script sets `REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT` to 1 on an availability group named `ag1`. Before you run replace `ag1` with the name of your availability group.
46
+
47
+
```SQL
48
+
ALTER AVAILABILITY GROUP [ag1]
49
+
SET REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT =1;
50
+
```
51
+
52
+
This setting ensures that every active transaction is committed to the primary replica and at least one synchronous secondary.
53
+
42
54
1. Demote the primary replica to secondary replica. After the primary replica is demoted, it is read-only. Run this command on the SQL instance hosting the primary replica to update the role to SECONDARY:
43
55
44
-
```Transact-SQL
45
-
ALTER AVAILABILITY GROUP [ag1] SET (ROLE = SECONDARY);
56
+
```SQL
57
+
ALTER AVAILABILITY GROUP [ag1]
58
+
SET (ROLE = SECONDARY);
46
59
```
47
60
48
61
1. Promote the target secondary replica to primary.
49
62
50
-
```Transact-SQL
51
-
ALTER AVAILABILITY GROUP distributedag FORCE_FAILOVER_ALLOW_DATA_LOSS;
63
+
```SQL
64
+
ALTER AVAILABILITY GROUP ag1 FORCE_FAILOVER_ALLOW_DATA_LOSS;
0 commit comments