记录事件 ID 4015,DNS 服务器遇到严重错误

本文有助于解决记录事件 ID 4015 且域名服务(DNS)服务器遇到严重错误的问题。

原始 KB 数: 969488、2733147

在以下方案之一中,你会收到事件 ID 4015:

  • 如果在只读域控制器(RODC)上运行 DNS 角色,并且无法访问可写域控制器(托管 DNS),则会在 RODC 上记录以下事件。

    Log Name: DNS Server
    Source: Microsoft-Windows-DNS-Server-Service
    Date: date time
    Event ID: 4015
    Task Category: None
    Level: Error
    Keywords: Classic
    User: N/A
    Computer: <ComputerName>
    Description:
    The DNS server has encountered a critical error from the Active Directory. Check that the Active Directory is functioning properly. The extended error debug information (which may be empty) is "00002095: SvcErr: DSID-03210A6A, problem 5012 (DIR_ERROR), data 16". The event data contains the error.
    
  • DNS 服务器无法访问 Active Directory 对象,并且以下事件经常记录在 DNS 服务器的事件日志中。

    Type: Error
    Source: DNS
    Category: None
    Event ID: 4015
    Description:
    The DNS server has encountered a critical error from the Active Directory. Check that the Active Directory is functioning properly. The extended error debug information (which may be empty) is "0000051B: AttrErr: DSID-xxxx, #1: 0:0000051B: DSID-xxxx, problem 1005 (CONSTRAINT_ATT_TYPE), data 0, Att 20119(nTSecurityDescriptor)". The eventdata contains the error."
    
  • 在位于 Active Directory 集成域名系统(DNS)区域的林或域中,已安装 DNS 服务器角色的某些域控制器已升级和降级。 某些升级的域控制器无法在 Active Directory 集成 DNS 区域中注册 SRV、主机 A、指针(PTR)或名称服务器(NS),并记录以下事件:

    The DNS server has encountered a critical error from the Active Directory. Check that the Active Directory is functioning properly. The extended error debug information (which may be empty) is "00002024: SvcErr: DSID-02050BBD, problem 5008 (ADMIN_LIMIT_EXCEEDED), data -1026". The event data contains the error.
    

RODC 每三分钟记录一次 DNS 事件 ID 4015,错误代码00002095

当 RODC 找到可写 DNS 服务器以执行 ReplicateSingleObject (RSO)时,它将执行具有以下标志集的 DSGETDC 函数:

  • DS_AVOID_SELF
  • DS_TRY_NEXTCLOSEST_SITE
  • DS_DIRECTORY_SERVICE_6_REQUIRED
  • DS_WRITEABLE_REQUIRED

从 DSGETDC 调用返回 DC 后,它会使用结果在 DNS 中搜索 NS 记录。 如果 DSGETDC 调用失败或找不到从 DSGETDC 返回的 DC 的 NS 记录,则会记录事件 ID 4015。

事件 ID 4015 的可能原因:

  • 无法访问可写 DC,也没有从 DSGETDC 调用返回任何可写 DC。
  • DSGETDC 调用成功,但返回的 DC 未安装 DNS 服务器角色,也没有在 DNS 中注册 NS 记录。

可以从 RODC 运行以下命令,以检查 DSGETDC 调用中返回的 DC:

nltest /dsgetdc: DOMAIN.COM /WRITABLE /AVOIDSELF /TRY_NEXT_CLOSEST_SITE /DS_6

域名的位置 DOMAIN.COM

有关 DSGETDC 函数的详细信息,请参阅 DsGetDcNameA 函数

若要解决上述任一原因,请确保可从 RODC 访问可写 DC、DNS 服务器角色安装在该 DC 上,以及 NS 记录在 DNS 中为可写 DC 注册。

记录事件 ID 4015 并显示错误代码 0000051B

此问题因权限问题而发生。 SYSTEM 不是 DNS 区域的所有者。 可以 启用现场工程诊断日志记录 来标识 DNS 区域并更改所有者。

将 DNS 区域所有者设置为 SYSTEM

若要解决此问题,请执行以下步骤:

  1. 启用日志记录后,再次在 DNS 服务器事件日志中看到 DNS 错误时,通过将以下注册表值设置为 0 来停止 AD 诊断字段工程日志记录:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Diagnostics\15 Field Engineering

  2. 将事件 ID 4015 的确切时间关联到目录服务事件 ID 1644,并标识 DNS 应用程序目录分区。

  3. 打开 ADSI 编辑(Adsiedit.msc)工具,并转到事件 ID 1644 中标识的对象 LDAP 位置,该位置与事件 ID 4015 相关。

  4. 右键单击该区域,转到“属性>安全性>高级”,并确保“所有者”设置为 SYSTEM。

使用扩展错误代码记录事件 ID 4015 (ADMIN_LIMIT_EXCEEDED)

当 DNS 服务器服务达到 dnsRecord Active Directory 中对象的多值属性限制 dnsNode 时,会出现此问题。 在 Active Directory 集成 DNS 区域中,DNS 名称由dnsNode对象表示,DNS 记录作为值存储在对象的属性dnsNodednsRecord。 降级域控制器的 DNS 资源记录(RR)不会自动从 dnsRecord 相关 Active Directory 分区的相应区域中的对象属性 dnsNode 中删除。 例如:

DC=..TrustAnchors,CN=MicrosoftDNS,DC=ForestDnsZones,DC=xxx,DC=xxx

向对象属性添加 dnsRecord 其他记录时,降级域控制器的 dnsNode 孤立条目会导致ADMIN_LIMIT_EXCEEDED错误。

若要检查每个分区中的当前记录数, repadmin 请运行以下命令:

repadmin /showattr . "CN=MicrosoftDNS,CN=System,DC=contoso,DC=com" /subtree /filter:"(objectclass=dnsnode)" /atts:"dnsRecord" /allvalues >c:\temp\dns_Domain.txt
repadmin /showattr . "CN=MicrosoftDNS,DC=DomainDnsZones,DC=contoso,DC=com" /subtree /filter:"(objectclass=dnsnode)" /atts:"dnsRecord" /allvalues>c:\temp\dns_DomainDnsZones.txt
repadmin /showattr . "CN=MicrosoftDNS,DC=ForestDnsZones,DC=contoso,DC=com" /subtree /filter:"(objectclass=dnsnode)" /atts:"dnsRecord" /allvalues >c:\temp\dns_ForestDnsZones.txt

输出显示相应 Active Directory 集成区域属性中的 dnsRecord 当前条目数。 例如:

DN: DC=@,DC=..TrustAnchors,CN=MicrosoftDNS,DC=ForestDnsZones,DC=contoso,DC=com
1280> dnsRecord: <48 byte blob>;

删除表示的域控制器的孤立条目

若要解决此问题,请从区域中删除所表示域控制器的所有孤立条目。 若要检查并选择性地删除这些条目,请运行以下 Windows PowerShell cmdlet:

Get-DnsServerResourceRecord -ZoneName trustanchors -RRType Ns
Remove-DnsServerResourceRecord -zonename trustanchors -RRType Ns -Name “@” -RecordData DC.contoso.com

如果需要删除单个主机的多个资源记录(RR),请运行以下 cmdlet:

$AllNsRecords = Get-DnsServerResourceRecord -ZoneName “trustanchors” -RRType Ns
Foreach($Record in $AllNsRecords){
If($Record.recorddata.nameserver -like "*dc2*"){
$Record | Remove-DnsServerResourceRecord -ZoneName trustanchors
}
}
$AllSrvRecords = Get-DnsServerResourceRecord -ZoneName “_msdcs.contoso.com” -RRType Srv
Foreach($Record in $AllSrvRecords){
If($Record.recorddata.domainname -like "*dc2*"){
$Record | Remove-DnsServerResourceRecord -ZoneName _msdcs.contoso.com
}
}

使用 TroubleShootingScript 启用调试日志记录 (TSS)

若要使用 TSS 在 DNS 服务器上启动跟踪,请运行以下 cmdlet:

.\TSS.ps1 -Scenario NET_DNSsrv -Mode Verbose -WaitEvent Evt:4015:'DNS Server'

注意

记录事件 ID 4015 后,跟踪日志记录将自动停止。

有关详细信息,请参阅 在联系Microsoft支持之前收集关键信息。