ActiveDirectory

How to Compact Active Directory Database

How to Compact Active Directory Database

In order to compact the size of the Active Directory Database you need to stop Active Directory Domain services.ย  If you are running Windows 2008 and above you can simply stop the ADDS service and proceed with the steps.ย  However, if you are running Windows 2003 you will need to restart your domain controller in Directory Services Restore Mode by rebooting, pressing F8 and choosing DSRM.

Stopping the service in Windows 2008 R2

compact1

After you have stopped the ADDS service (Windows 2008 and higher) or restarted in DSRM (Windows Server 2003 and below) you can proceed to launch the NTDSUTIL utility to run maintenance on your Active Directory files.

NTDSUTIL

  • run ntdsutil at a command prompt after stopping ADDS
  • type files
  • If you get an error about the Active Instance not being set, then type Active Instance NTDS and this will set the instance
  • type files again if you had to set the Active Instance
  • type compact to c:yourfoldername replacing the path with one of your choosing
  • the database will then be compacted and you will see the status indicator moving across until finished.

compact2

After the compacting process finishes, you receive instructions on what to do next:

  • You are told to copy your compacted file to “Location of your AD database currently”
  • Delete old log files in the ADDS log file directory

compact3

 

compact4

 

compact5

 

After you have finished copying the compacted file to the proper location, and deleted the log files, you can then restart the ADDS service or restart your pre Windows 2008 domain controller normally.

compact6

 

Final Thoughts

The compacting process for an Active Directory database is pretty straightforward.ย  Keep in mind that you will need to do this on all domain controllers that need to be compacted as the physical database itself isn’t replicated to all other domain controllers.

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.



Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com, and a 7-time VMware vExpert, with over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.