Normally the Active Directory database defragments itself every 12 hours. This process happens automatically, and optimizes the database so that data is accessed as quickly as possible and space for new objects is freed up. What it does not do, however, is compact the database if a great many objects have been deleted.
You can use the NTDSUTIL tool to compact the Active Directory database. Compacting the Active Directory database also defragments it, but it's a process that requires a Domain Controller to be rebooted in Directory Service Restore mode, since it requires that the Active Directory database be manipulated directly. You also need to back up the System State beforehand (by using the built-in Windows 2000 Backup tool).
There is another way to compact the Active Directory database, which also requires starting in Directory Service Restore mode, but which also performs integrity checks on the database at the same time. Exchange Server ships with a tool called ESENTUTL, also packaged with Windows 2000 Server, which analyzes and repairs databases. To run it on the Active Directory database, go into the directory with the NTDS.DIT file (the default name for the Active Directory database) and type ESENTUTL //D NTDS.DIT
Serdar Yegulalp is the editor of the Windows 2000 Power Users Newsletter.