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/database-engine/availability-groups/windows/configure-backup-on-availability-replicas-sql-server.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,11 +156,11 @@ ms.author: mathoma
156
156
## <a name="FollowUp"></a> Follow Up: After Configuring Backup on Secondary Replicas
157
157
To take the automated backup preference into account for a given availability group, on each server instance that hosts an availability replica whose backup priority is greater than zero (>0), you need to script backup jobs for the databases in the availability group. To determine whether the current replica is the preferred backup replica, use the [sys.fn_hadr_backup_is_preferred_replica](../../../relational-databases/system-functions/sys-fn-hadr-backup-is-preferred-replica-transact-sql.md) function in your backup script. If the availability replica that is hosted by the current server instance is the preferred replica for backups, this function returns 1. If not, the function returns 0. By running a simple script on each availability replica that queries this function, you can determine which replica should run a given backup job. For example, a typical snippet of a backup-job script would look like:
158
158
159
-
```
159
+
```sql
160
160
IF (NOT sys.fn_hadr_backup_is_preferred_replica(@DBNAME))
161
161
BEGIN
162
162
Select 'This is not the preferred replica, exiting with success';
163
-
RETURN 0 - This is a normal, expected condition, so the script returns success
163
+
RETURN 0 -- This is a normal, expected condition, so the script returns success
Copy file name to clipboardExpand all lines: docs/database-engine/availability-groups/windows/configure-distributed-availability-groups.md
+47-24Lines changed: 47 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Configure a distributed availability group"
3
3
description: "Describes how to create and configure an Always On distributed availability group. "
4
4
ms.custom: "seodec18"
5
-
ms.date: "08/17/2017"
5
+
ms.date: "01/28/2020"
6
6
ms.prod: sql
7
7
ms.reviewer: ""
8
8
ms.technology: high-availability
@@ -140,7 +140,7 @@ GO
140
140
### Create a listener for the secondary availability group
141
141
Next add a listener for the secondary availability group on the second WSFC. In this example, the listener is named `ag2-listener`. For detailed instructions on creating a listener, see [Create or Configure an Availability Group Listener (SQL Server)](../../../database-engine/availability-groups/windows/create-or-configure-an-availability-group-listener-sql-server.md).
142
142
143
-
```
143
+
```sql
144
144
ALTER AVAILABILITY GROUP [ag2]
145
145
ADD LISTENER 'ag2-listener' ( WITH IP ( ('2001:db88:f0:f00f::cf3c'),('2001:4898:e0:f213::4ce2') ) , PORT =60173);
146
146
GO
@@ -222,15 +222,15 @@ ALTER DATABASE [db1] SET HADR AVAILABILITY GROUP = [ag2];
222
222
223
223
Only manual failover is supported at this time. To manually fail over a distributed availability group:
224
224
225
-
1. To ensure that no data is lost, set the distributed availability group to synchronous commit.
226
-
1. Wait until the distributed availability group is synchronized.
225
+
1. To ensure that no data is lost, stop all transactions on the global primary databases (that is, databases of the primary availability group), then set the distributed availability group to synchronous commit.
226
+
1. Wait until the distributed availability group is synchronized and has the same last_hardened_lsn per database.
227
227
1. On the global primary replica, set the distributed availability group role to `SECONDARY`.
228
228
1. Test failover readiness.
229
229
1. Fail over the primary availability group.
230
230
231
231
The following Transact-SQL examples demonstrate the detailed steps to fail over the distributed availability group named `distributedag`:
232
232
233
-
1.Set the distributed availability group to synchronous commit by running the following code on *both* the global primary and the forwarder.
233
+
1.To ensure that no data is lost, stop all transactions on the global primary databases (that is, databases of the primary availability group). Then set the distributed availability group to synchronous commit by running the following code on *both* the global primary and the forwarder.
234
234
235
235
```sql
236
236
-- sets the distributed availability group to synchronous commit
@@ -256,24 +256,29 @@ The following Transact-SQL examples demonstrate the detailed steps to fail over
256
256
GO
257
257
258
258
```
259
-
>[!NOTE]
260
-
>In a distributed availability group, the synchronization status between the two availability groups depends on the availability mode of both replicas. For synchronous commit mode, both the current primary availability group, and the current secondary availability group must have `SYNCHRONOUS_COMMIT` availability mode. For this reason, you must run the script above on both the global primary replica, and the forwarder.
259
+
> [!NOTE]
260
+
>In a distributed availability group, the synchronization status between the two availability groups depends on the availability mode of both replicas. For synchronous commit mode, both the current primary availability group, and the current secondary availability group must have `SYNCHRONOUS_COMMIT` availability mode. For this reason, you must run the script above on both the global primary replica, and the forwarder.
261
+
261
262
262
-
1. Wait until the status of the distributed availability group has changed to `SYNCHRONIZED`. Run the following query on the global primary, which is the primary replica of the primary availability group.
263
+
1. Wait until the status of the distributed availability group has changed to `SYNCHRONIZED`and all replicas have the same last_hardened_lsn (per database). Run the following query onboth the global primary, which is the primary replica of the primary availability group, and the forwarder to check the synchronization_state_desc and last_hardened_lsn:
263
264
264
265
```sql
266
+
-- Run this query on the Global Primary and the forwarder
267
+
-- Check the results to see if synchronization_state_desc is SYNCHRONIZED, and the last_hardened_lsn is the same per database on both the global primary and forwarder
268
+
-- If not rerun the query on both side every 5 seconds until it is the case
269
+
--
265
270
SELECT ag.name
266
271
, drs.database_id
272
+
, db_name(drs.database_id) as database_name
267
273
, drs.group_id
268
274
, drs.replica_id
269
275
, drs.synchronization_state_desc
270
-
, drs.end_of_log_lsn
271
-
FROM sys.dm_hadr_database_replica_states drs,
272
-
sys.availability_groups ag
273
-
WHERE drs.group_id = ag.group_id;
276
+
, drs.last_hardened_lsn
277
+
FROM sys.dm_hadr_database_replica_states drs
278
+
INNER JOIN sys.availability_groups ag on drs.group_id = ag.group_id;
274
279
```
275
280
276
-
Proceed after the availability group **synchronization_state_desc** is `SYNCHRONIZED`. If **synchronization_state_desc** is not `SYNCHRONIZED`, run the command every five seconds until it changes. Do not proceed until the **synchronization_state_desc**=`SYNCHRONIZED`.
281
+
Proceed after the availability group **synchronization_state_desc** is `SYNCHRONIZED`, and the last_hardened_lsn is the same per database on both the global primary and forwarder. If **synchronization_state_desc** is not `SYNCHRONIZED`or last_hardened_lsn is not the same, run the command every five seconds until it changes. Do not proceed until the **synchronization_state_desc**=`SYNCHRONIZED`and last_hardened_lsn is the same per database.
277
282
278
283
1. On the global primary, set the distributed availability group role to `SECONDARY`.
279
284
@@ -283,23 +288,41 @@ The following Transact-SQL examples demonstrate the detailed steps to fail over
283
288
284
289
At this point, the distributed availability group is not available.
285
290
286
-
1. Test the failover readiness. Run the following query:
291
+
1. Test the failover readiness. Run the following queryon both the global primary and the forwarder:
287
292
288
293
```sql
289
-
SELECT ag.name,
290
-
drs.database_id,
291
-
drs.group_id,
292
-
drs.replica_id,
293
-
drs.synchronization_state_desc,
294
-
drs.end_of_log_lsn
295
-
FROM sys.dm_hadr_database_replica_states drs, sys.availability_groups ag
296
-
WHERE drs.group_id = ag.group_id;
294
+
-- Run this query on the Global Primary and the forwarder
295
+
-- Check the results to see if the last_hardened_lsn is the same per database on both the global primary and forwarder
296
+
-- The availability group is ready to fail over when the last_hardened_lsn is the same for both availability groups per database
297
+
--
298
+
SELECT ag.name,
299
+
drs.database_id,
300
+
db_name(drs.database_id) as database_name,
301
+
drs.group_id,
302
+
drs.replica_id,
303
+
drs.last_hardened_lsn
304
+
FROM sys.dm_hadr_database_replica_states drs
305
+
INNER JOIN sys.availability_groups ag ON drs.group_id = ag.group_id;
297
306
```
298
-
The availability group is ready to fail over when the **synchronization_state_desc** is `SYNCHRONIZED`and the **end_of_log_lsn** is the same for both availability groups.
299
307
300
-
1. Fail over from the primary availability group to the secondary availability group. Run the following command on the SQL Server that hosts the primary replica for the secondary availability group.
308
+
The availability group is ready to fail over when the **last_hardened_lsn** is the same for both availability groups per database. If the last_hardened_lsn is not the same after a period of time, to avoid data loss, fail back to the global primary by running this command on the global primary and then start over from the second step:
309
+
310
+
```sql
311
+
-- If the last_hardened_lsn is not the same after a period of time, to avoid data loss,
312
+
-- we need to fail back to the global primary by running this command on the global primary
313
+
-- and then start over from the second step:
314
+
315
+
ALTER AVAILABILITY GROUP distributedag FORCE_FAILOVER_ALLOW_DATA_LOSS;
316
+
```
317
+
318
+
319
+
1. Fail over from the primary availability group to the secondary availability group. Run the following command on the forwarder, the SQL Server that hosts the primary replica of the secondary availability group.
301
320
302
321
```sql
322
+
-- Once the last_hardened_lsn is the same per database on both sides
323
+
-- We can Fail over from the primary availability group to the secondary availability group.
324
+
-- Run the following command on the forwarder, the SQL Server instance that hosts the primary replica of the secondary availability group.
325
+
303
326
ALTER AVAILABILITY GROUP distributedag FORCE_FAILOVER_ALLOW_DATA_LOSS;
Copy file name to clipboardExpand all lines: docs/relational-databases/errors-events/database-engine-events-and-errors.md
+38-2Lines changed: 38 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "Database engine events and errors"
3
3
ms.custom: ""
4
-
ms.date: 01/11/2019
4
+
ms.date: 01/28/2020
5
5
ms.prod: sql
6
6
ms.reviewer: ""
7
7
ms.technology: supportability
@@ -14,6 +14,17 @@ ms.author: mathoma
14
14
15
15
The table contains error message numbers and the description, which is the text of the error message from the sys.messages catalog view. Where applicable, the error number is a link to further information.
16
16
17
+
This list is not exhaustive. For a full list of all errors, query the sys.messages catalog view with the following query:
18
+
19
+
```sql
20
+
SELECT message_id AS Error, severity AS Severity,
21
+
[Event Logged] = CASE is_event_logged WHEN 0 THEN 'No' ELSE 'Yes' END,
22
+
text AS [Description]
23
+
FROM sys.messages
24
+
WHERE language_id = <desired language, such as 1033 for US English>
25
+
ORDER BY message_id
26
+
```
27
+
17
28
## Errors -2 to 999
18
29
19
30
| Error| Severity | Event Logged | Description|
@@ -568,8 +579,32 @@ The table contains error message numbers and the description, which is the text
568
579
| 971 | 10 | No | The resource database has been detected in two different locations. Attaching the resource database in the same directory as sqlservr.exe at '%.*ls' instead of the currently attached resource database at '%.*ls'. |
569
580
| 972 | 17 | No | Could not use database '%d' during procedure execution. |
570
581
| 973 | 10 | Yes | Database %ls was started . However, FILESTREAM is not compatible with the READ_COMMITTED_SNAPSHOT and ALLOW_SNAPSHOT_ISOLATION options. Either remove the FILESTREAM files and the FILESTREAM filegroups, or set READ_COMMITTED_SNAPSHOT and ALLOW_SNAPSHOT_ISOLATION to OFF. |
582
+
|974 | 10 | No | Attaching the resource database in the same directory as sqlservr.exe at '%.*ls' failed as the database files do not exist.|
583
+
|975 | 10 | Yes | System objects could not be updated in database '%.*ls' because it is read-only. |
584
+
|976 | 14 | No | The target database, '%.*ls', is participating in an availability group and is currently not accessible for queries. Either data movement is suspended or the availability replica is not enabled for read access. To allow read-only access to this and other d |
585
+
|977 | 10 | No | Warning: Could not find associated index for the constraint '%.*ls' on object_id '%d' in database '%.*ls'.|
586
+
|978 | 14 | No | The target database ('%.*ls') is in an availability group and is currently accessible for connections when the application intent is set to read only. For more information about application intent, see SQL Server Books Online. |
587
+
|979 | 14 | No | The target database ('%.*ls') is in an availability group and currently does not allow read only connections. For more information about application intent, see SQL Server Books Online.|
588
+
|980 | 21 | Yes | SQL Server cannot load database '%.*ls' because it contains a columnstore index. The currently installed edition of SQL Server |does not support columnstore indexes. Either disable the columnstore index in the database by using a supported edition of SQL Se|
589
+
|981 | 10 | No | Database manager will be using %d target database version. |
590
+
|982 | 14 | No | Unable to access the '%.*ls' database because no online secondary replicas are enabled for read-only access. Check the availability group configuration to verify that at least one secondary replica is configured for read-only access. Wait for an enabled re|
591
+
|983 | 14 | No | Unable to access availability database '%.*ls' because the database replica is not in the PRIMARY or SECONDARY role. Connections to an availability database is permitted only when the database replica is in the PRIMARY or SECONDARY role. Try the operation |
592
+
|984 | 21 | Yes | Failed to perform a versioned copy of sqlscriptdowngrade.dll from Binn to Binn\Cache folder. VerInstallFile API failed with error code %d.|
593
+
|985 | 10 | Yes | Successfully installed the file '%ls' into folder '%ls'. |
594
+
|986 | 10 | No | Couldn't get a clean bootpage for database '%.*ls' after %d tries. This is an informational message only. No user action is required. |
595
+
|987 | 23 | Yes | A duplicate key insert was hit when updating system objects in database '%.*ls'.|
596
+
|988 | 14 | No | Unable to access database '%.*ls' because it lacks a quorum of nodes for high availability. Try the operation again later.|
597
+
|989 | 16 | No | Failed to take the host database with ID %d offline when one or more of its partition databases is marked as suspect.|
598
+
|990 | 16 | No | Taking the host database with ID %d offline because one or more of its partition databases is marked as suspect.|
599
+
|991 | 16 | No | Failed to take the host database '%.*ls' offline when one or more of its partition databases is marked as suspect.|
600
+
|992 | 16 | No | Failed to get the shared lock on database '%.*ls'.|
601
+
|993 | 10 | No | Redo for database '%.*ls' applied version upgrade step from %d to %d.|
602
+
|994 | 10 | No | Warning: Index "%.*ls" on "%.*ls"."%.*ls" is disabled because it contains a computed column.|
603
+
|995 | 10 | No | Warning: Index "%.*ls" on "%.*ls"."%.*ls" is disabled. It cannot be upgraded as it resides on a read-only filegroup.|
604
+
|996 | 10 | No | Warning: Index "%.*ls" on "%.*ls"."%.*ls" is disabled. This columnstore index cannot be upgraded, likely because it exceeds the row size limit of '%d' bytes.|
571
605
| | | | |
572
606
607
+
573
608
## Errors 1000 to 1999
574
609
575
610
| Error| Severity | Event Logged | Description|
@@ -2152,11 +2187,12 @@ The table contains error message numbers and the description, which is the text
2152
2187
| 4863 | 16 | No | Bulk load data conversion error (truncation) for row %d, column %d (%ls). |
2153
2188
| 4864 | 16 | No | Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row %d, column %d (%ls). |
2154
2189
| 4865 | 16 | No | Cannot bulk load because the maximum number of errors (%d) was exceeded. |
2155
-
| 4866 | 16 | No | The bulk load failed. The column is too long in the data file for row %d, column %d. Verify that the field terminator and row terminator are specified correctly. |
2190
+
| 4866 | 16 | No | The bulk load failed. The column is too long in the data file for row %d, column %d. Verify that the field terminator and row terminator are specified correctly. | Bulk load failed due to invalid column value in CSV data file %ls in row %d, column %d |
2156
2191
| 4867 | 16 | No | Bulk load data conversion error (overflow) for row %d, column %d (%ls). |
2157
2192
| 4868 | 16 | No | The bulk load failed. The codepage "%d" is not installed. Install the codepage and run the command again. |
2158
2193
| 4869 | 16 | No | The bulk load failed. Unexpected NULL value in data file row %d, column %d. The destination column (%ls) is defined as NOT NULL. |
2159
2194
| 4870 | 16 | No | Cannot bulk load because of an error writing file "%ls". Operating system error code %ls. |
2195
+
| 4879 | 16 | No |
2160
2196
| 4871 | 16 | No | Bulk load error while attempting to log errors. |
2161
2197
| 4872 | 16 | No | Line %d in format file "%ls": duplicate element id "%ls". |
2162
2198
| 4873 | 16 | No | Line %d in format file "%ls": referencing non-existing element id "%ls". |
Copy file name to clipboardExpand all lines: docs/relational-databases/errors-events/mssqlserver-18456-database-engine-error.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,7 @@ To increase security, the error message that is returned to the client deliberat
67
67
|12|Login is valid login, but server access failed.|
68
68
|18|Password must be changed.|
69
69
|38, 46|Could not find database requested by user.|
70
+
|58| When SQL Server is set to use Windows Authentication only, and a client attempts to log in using SQL authentication. Another cause is when SIDs do not match.|
70
71
|102 - 111|AAD failure.|
71
72
|122 - 124|Failure due to empty user name or password.|
0 commit comments