大网数据广告活动
数据库与应用安全

Always On availability groups check failed after changing the hostname

· 52CE 我爱测

This article provides workarounds for the issue that occurs after you change the hostname.

Applies to:   SQL Server 2019, SQL Server 2017

Symptoms

After changing the hostname of a server hosting Microsoft SQL Server 2019 or SQL Server 2017, you experience issues with Always On availability groups or replication. These issues occur after installing the SQL Server 2019 cumulative update (CU) 9, SQL Server 2017 CU23, or a later CU.

Here are error examples:

  • Error: 19435, Severity: 16, State: 1.
    Always On: AG integrity check failed for AG 'AGPRD' with error 41041, severity 16, state 0.
    Always On: Availability group 'AGPRD' was removed while the availability replica on this instance of SQL Server was offline. The local replica will be removed now.

  • SQL Server replication requires the actual server name to make a connection to the server. Specify the actual server name.

Cause

By default, the new hostname is reported in the ServerName property of the SERVERPROPERTY function and the SQL Server error log. After installing SQL Server 2019 CU9, SQL Server 2017 CU23 or a later CU, the new server name isn't derived from the hostname but from sys.servers view. These issues occur if the hostname doesn't match sys.servers.

Workaround

  1. After changing the hostname, remove the old name from the list of known remote and linked servers on the local instance of SQL Server. Run the sp_dropserver procedure:

    EXEC sp_dropserver '<old_name>';  
    GO
    
  2. Provide the new name to the SQL Server Database Engine instance. Run the sp_addserver procedure:

    EXEC sp_addserver '<new_name>', local;
    GO
    

For more information, see rename a computer that hosts a stand-alone instance of SQL Server.

Status

  • For SQL Server on Linux, a comprehensive solution has been scheduled for the next version of SQL Server.
  • For SQL Server on Windows, this issue has been fixed in SQL Server 2017 CU27 and SQL Server 2019 CU13.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 10/13/2021
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。