Windows Server 2008 allows you to start, stop, and restart the Active Directory Domain service on the domain controller, which allows the Active Directory service to be maintained like any other service. Prior to Windows Server 2008, the DC needs to be stopped to perform offline maintenance tasks. In Windows Server 2008, the offline maintenance tasks can be performed without restarting the domain controller in Directory Services Repair Mode.

To perform database management procedures or other offline maintenance tasks, you can simply stop the AD DS service. However, before you stop the AD DS service you need to make sure that the DC is able to communicate with other DC that is running this service. As soon as you try to stop the AD DS service, the services that depend on AD DS to function shut down before AD DS shuts down.

The services that depend on AD DS are: DNS Server service, File Replication Service (FRS), Kerberos Key Distribution Center (KDC), Intersite Messaging, Distributed File System (DFS) Replication.

The other services that do not depend on AD DS to function do not stop and keep on servicing client requests such as DHCP. Because this feature allows the AD DS to behave natively, you can script the defragmentation and compaction operations through basic command line tools.

You can perform Defragmentation and Compaction operation on the Directory Database
File as offline maintenance. To perform Defragmentation and Compaction operation on
AD DS, you need to:
  1. Ensure that at least two DCs are running in the domain and are able to communicate with each other
  2. Log on to AD DS as a domain administrator
  3. Create two folders as C:\Temp and a C:\OriginalNTDS folder to be used as temporary locations for compacted and original database.
  4. Open Server Manager and click Services under the Configuration node, as shown in Figure 6-4:
    Figure 6-4
  5. Right-click AD DS service and stop the service.
  6. Click Yes to stop the other dependent services in the Stop Other Services dialog box that appears.
  7. Launch the elevated command prompt by right clicking the Command Prompt item in the Start menu.and selecting Run as Administrator option from the menu that appears.
  8. Type the following commands to begin the compacting of database:NtdsutilActivate instance NTDS


    Compact to C:\Temp

    The NTdsutil utility will start the compaction process of the database.

  9. Type the following after the compaction is completed:QuitQuit
  10. Delete the log files so that you can use the newly created compact file because the old log files will not work with the compact database by typing:Cd %systemroot%\ntdsDel *.log
  11. Backup the Ntds.dit by typingCopy Ntds.dit \originalntds
  12. Copy the newly compacted database to the original NTDS folderCopy C:\temp\Ntds.dit
  13. You can now verify the integrity of the new database instance by typing: Ntdsutil Activate instance NTDS




    Semantic Database analysis

    Go fixup



    If the integrity check fails then you need to recopy the original ntds.dit back to its original location

  14. Start the AD DS service from the Server Manager