RODC: How to Defrag or Compact the Active Directory Database

A Read Only Domain Controller has the benefit of being able to perform administrative maintenance tasks without entering into Active Directory Restore Mode which previously required a reboot. The following command shows how to compact the Active Directory database from the command line. Before you start, remember not to leave the Active Directory Services stopped for a long period of time since replication of the active directory data will not occur during the period where it is shut down.

  1. Stop the Active Directory Services.
  2. From the command prompt with administrative privileges
    1. type ntdsutil and press enter
    2. type activate instance ntds and press enter
    3. type files and press enter
    4. type info and press enter
    5. type compact to c:\TEMP and press enter 
  3. If you have successfully compacted the database you can now copy the files back to the proper location and delete the temp files. To do so execute the following command from the command prompt
    1. type copy “c:\TEMP\ntds.dit” “c:\Windows\NTDS\ntds.dit” and press enter
    2. When prompted press Y to overwrite and press enter.
  4. Restart the Active Directory Services

Jeff Loucks
Available Technology
Available Technology
  Subscribe in a reader 


Leave a Reply

Your email address will not be published. Required fields are marked *