Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit ed6698f

Browse files
authored
Merge pull request #13566 from MashaMSFT/20200122_fixes
Misc fixes based on issues
2 parents dd7b640 + 4395b4e commit ed6698f

4 files changed

Lines changed: 88 additions & 28 deletions

File tree

docs/database-engine/availability-groups/windows/configure-backup-on-availability-replicas-sql-server.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ ms.author: mathoma
156156
## <a name="FollowUp"></a> Follow Up: After Configuring Backup on Secondary Replicas
157157
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:
158158
159-
```
159+
```sql
160160
IF (NOT sys.fn_hadr_backup_is_preferred_replica(@DBNAME))
161161
BEGIN
162162
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
164164
END
165165
BACKUP DATABASE @DBNAME TO DISK=<disk>
166166
WITH COPY_ONLY;

docs/database-engine/availability-groups/windows/configure-distributed-availability-groups.md

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Configure a distributed availability group"
33
description: "Describes how to create and configure an Always On distributed availability group. "
44
ms.custom: "seodec18"
5-
ms.date: "08/17/2017"
5+
ms.date: "01/28/2020"
66
ms.prod: sql
77
ms.reviewer: ""
88
ms.technology: high-availability
@@ -140,7 +140,7 @@ GO
140140
### Create a listener for the secondary availability group
141141
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 &#40;SQL Server&#41;](../../../database-engine/availability-groups/windows/create-or-configure-an-availability-group-listener-sql-server.md).
142142

143-
```
143+
```sql
144144
ALTER AVAILABILITY GROUP [ag2]
145145
ADD LISTENER 'ag2-listener' ( WITH IP ( ('2001:db88:f0:f00f::cf3c'),('2001:4898:e0:f213::4ce2') ) , PORT = 60173);
146146
GO
@@ -222,15 +222,15 @@ ALTER DATABASE [db1] SET HADR AVAILABILITY GROUP = [ag2];
222222

223223
Only manual failover is supported at this time. To manually fail over a distributed availability group:
224224

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.
227227
1. On the global primary replica, set the distributed availability group role to `SECONDARY`.
228228
1. Test failover readiness.
229229
1. Fail over the primary availability group.
230230

231231
The following Transact-SQL examples demonstrate the detailed steps to fail over the distributed availability group named `distributedag`:
232232

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.
234234

235235
```sql
236236
-- sets the distributed availability group to synchronous commit
@@ -256,24 +256,29 @@ The following Transact-SQL examples demonstrate the detailed steps to fail over
256256
GO
257257

258258
```
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+
261262

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 on both 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:
263264

264265
```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+
--
265270
SELECT ag.name
266271
, drs.database_id
272+
, db_name(drs.database_id) as database_name
267273
, drs.group_id
268274
, drs.replica_id
269275
, 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;
274279
```
275280

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.
277282

278283
1. On the global primary, set the distributed availability group role to `SECONDARY`.
279284

@@ -283,23 +288,41 @@ The following Transact-SQL examples demonstrate the detailed steps to fail over
283288

284289
At this point, the distributed availability group is not available.
285290

286-
1. Test the failover readiness. Run the following query:
291+
1. Test the failover readiness. Run the following query on both the global primary and the forwarder:
287292

288293
```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;
297306
```
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.
299307

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.
301320

302321
```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+
303326
ALTER AVAILABILITY GROUP distributedag FORCE_FAILOVER_ALLOW_DATA_LOSS;
304327
```
305328

docs/relational-databases/errors-events/database-engine-events-and-errors.md

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Database engine events and errors"
33
ms.custom: ""
4-
ms.date: 01/11/2019
4+
ms.date: 01/28/2020
55
ms.prod: sql
66
ms.reviewer: ""
77
ms.technology: supportability
@@ -14,6 +14,17 @@ ms.author: mathoma
1414

1515
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.
1616

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+
1728
## Errors -2 to 999
1829

1930
| Error| Severity | Event Logged | Description|
@@ -568,8 +579,32 @@ The table contains error message numbers and the description, which is the text
568579
| 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'. |
569580
| 972 | 17 | No | Could not use database '%d' during procedure execution. |
570581
| 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.|
571605
| &nbsp; | &nbsp; |&nbsp; | &nbsp; |
572606

607+
573608
## Errors 1000 to 1999
574609

575610
| Error| Severity | Event Logged | Description|
@@ -2152,11 +2187,12 @@ The table contains error message numbers and the description, which is the text
21522187
| 4863 | 16 | No | Bulk load data conversion error (truncation) for row %d, column %d (%ls). |
21532188
| 4864 | 16 | No | Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row %d, column %d (%ls). |
21542189
| 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 |
21562191
| 4867 | 16 | No | Bulk load data conversion error (overflow) for row %d, column %d (%ls). |
21572192
| 4868 | 16 | No | The bulk load failed. The codepage "%d" is not installed. Install the codepage and run the command again. |
21582193
| 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. |
21592194
| 4870 | 16 | No | Cannot bulk load because of an error writing file "%ls". Operating system error code %ls. |
2195+
| 4879 | 16 | No |
21602196
| 4871 | 16 | No | Bulk load error while attempting to log errors. |
21612197
| 4872 | 16 | No | Line %d in format file "%ls": duplicate element id "%ls". |
21622198
| 4873 | 16 | No | Line %d in format file "%ls": referencing non-existing element id "%ls". |

docs/relational-databases/errors-events/mssqlserver-18456-database-engine-error.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ To increase security, the error message that is returned to the client deliberat
6767
|12|Login is valid login, but server access failed.|
6868
|18|Password must be changed.|
6969
|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.|
7071
|102 - 111|AAD failure.|
7172
|122 - 124|Failure due to empty user name or password.|
7273
|126|Database requested by user does not exist.|

0 commit comments

Comments
 (0)