當您在 Windows Server 2008 中執行 Adprep /rodcprep 命令時發生錯誤:Adprep 無法連絡分割區 DC=DomainDnsZones,DC=Contoso,DC=com 的複本

本文解決命令無法順利完成的問題, Adprep /rodcprep 因為無法連線到一或多個 Active Directory NDNIC 的基礎結構主機。

適用:Windows Server 2012 R2
原始 KB 編號: 949257

徵狀

當您在 Adprep /rodcprep Windows Server 2008 上執行 命令時,您會收到下列錯誤訊息:

Adprep 無法連絡分割區 DC=DomainDnsZones,DC=Contoso,DC=com 的複本

Adprep 在分割區 DC=DomainDnsZones,DC=Contoso,DC=com 略過至下一個分割區時,作業失敗。

Adprep 無法連絡分割區 DC=ForestDnsZones,DC=Contoso,DC=com 的複本

Adprep 發生 LDAP 錯誤。 錯誤碼:0x0。 伺服器擴充錯誤碼:0x0、伺服器錯誤訊息: (null) 。

Adprep 在分割區 DC=ForestDnsZones,DC=Contoso,DC=com 略過至下一個分割區時失敗。

Adprep 已完成併發生錯誤。 並非所有數據分割都會更新。

原因

當命令嘗試連絡樹系中每個應用程式分割區的基礎結構主機時 Adprep /rodcprep ,就會發生此問題。 此命令會執行此動作來設定 Read-Only 域控制器 (RODC) 複寫所需的許可權。 Adprep /rodcprep如果下列其中一個條件成立,命令就會失敗:

  • 錯誤訊息中參考的數據分割或分割區已不存在。
  • 參考之分割區或數據分割的基礎結構主機已強制降級或離線。

解決方案

若要在分割區已不存在時解決此問題,請使用 Dsmgmt 工具的 “remove nc” 參數,針對孤立的數據分割執行元數據清除。 如需詳細資訊,請造訪下列 Microsoft 網站:

數據分割管理

如果指定的數據分割存在,請指定數據分割在在線的基礎結構角色擁有者。 您可以手動修改 物件上的 fSMORoleOwner 屬性,如一節中所述。

其他相關資訊

下列腳本範例會修改指定非網域命名內容之基礎結構物件上的 fSMORoleOwner 屬性, (NDNC) 至作用中或可連絡的伺服器。 此範例中的 NDNC 是 DomainDnsZones,DC=contoso,DC=com NDNC 命名內容。 文稿會使用下列命令:

cscript fixfsmo.vbs DC=DomainDnsZones,DC=contoso,DC=com
'-------fixfsmo.vbs------------------
const ADS_NAME_INITTYPE_GC = 3
const ADS_NAME_TYPE_1779 = 1
const ADS_NAME_TYPE_CANONICAL = 2

set inArgs = WScript.Arguments

if (inArgs.Count = 1) then
    ' Assume the command line argument is the NDNC (in DN form) to use.
    NdncDN = inArgs(0)
Else
    Wscript.StdOut.Write "usage: cscript fixfsmo.vbs NdncDN"
End if

if (NdncDN <> "") then

    ' Convert the DN form of the NDNC into DNS dotted form.
    Set objTranslator = CreateObject("NameTranslate")
    objTranslator.Init ADS_NAME_INITTYPE_GC, ""
    objTranslator.Set ADS_NAME_TYPE_1779, NdncDN
    strDomainDNS = objTranslator.Get(ADS_NAME_TYPE_CANONICAL)
    strDomainDNS = Left(strDomainDNS, len(strDomainDNS)-1)

    Wscript.Echo "DNS name: " & strDomainDNS

    ' Find a domain controller that hosts this NDNC and that is online.
    set objRootDSE = GetObject("LDAP://" & strDomainDNS & "/RootDSE")
    strDnsHostName = objRootDSE.Get("dnsHostName")
    strDsServiceName = objRootDSE.Get("dsServiceName")
    Wscript.Echo "Using DC " & strDnsHostName

    ' Get the current infrastructure fsmo.
    strInfraDN = "CN=Infrastructure," & NdncDN
    set objInfra = GetObject("LDAP://" & strInfraDN)
    Wscript.Echo "infra fsmo is " & objInfra.fsmoroleowner

    ' If the current fsmo holder is deleted, set the fsmo holder to this domain controller.

    if (InStr(objInfra.fsmoroleowner, "\0ADEL:") > 0) then

        ' Set the fsmo holder to this domain controller.
        objInfra.Put "fSMORoleOwner",  strDsServiceName
        objInfra.SetInfo

        ' Read the fsmo holder back.
        set objInfra = GetObject("LDAP://" & strInfraDN)
        Wscript.Echo "infra fsmo changed to:" & objInfra.fsmoroleowner

    End if

End if

若要判斷數據分割的基礎結構主機,請在有問題的命名內容根目錄底下,查詢基礎結構物件上的 fSMORoleOwner 屬性。 例如,查詢 CN=Infrastructure,DC=DomainDnsZones,DC=contoso,DC=com 命名內容根目錄上的 fSMORoleOwner 屬性,以判斷 DC=DomainDnsZones,DC=contoso,DC=com 數據分割的基礎結構主圖形。 同樣地,查詢 CN=Infrastructure,DC=ForestDnsZones,DC=contoso,DC=com 命名內容根目錄上的 fSMORoleOwner 屬性,以判斷 DC=ForestDnsZones,DC=contoso,DC=com 數據分割的基礎結構主圖形。

您可以使用在 ADS 工具、Active Directory 服務介面 (ADSI) 編輯工具,以及 ldifde 工具等工具來執行這些查詢。 例如,下列查詢會使用 Idifde 工具:

ldifde -f Infra_DomainDNSZones.ldf -d “CN=Infrastructure,DC=DomainDnsZones,DC=contoso,DC=com” -l fSMORoleOwner

此查詢會將 DC=DomainDnsZones,DC=contoso,DC=com 磁碟分區的基礎結構主要角色擁有者傳回至 Infra_DomainDNSZones.ldf 檔案。

注意事項

您可以多次執行命令, Adprep /rodcprep 而不會損害樹系。 在先前執行 rodcprep 命令時完成的作業不會重複。

如果您嘗試在隔離的環境中執行 rodcprep 命令,則每個網域和每個應用程式目錄分割區的基礎結構主機都必須可在環境中使用,作業才能成功。