|Brien M. Posey|
Just like any other type of database, the Active Directory database tends to become fragmented through normal use. The process of adding and removing objects naturally creates fragmentation. Windows 2000 uses the Garbage Collection Process and Online Defragmentation to get rid of most of the fragmentation that occurs. However, there are limits. Neither of these processes can reclaim lost space within the database. Fortunately, there is a way to reclaim this lost space, while helping your Active Directory database to run more efficiently. The process is called Offline Defragmentation.
Offline Defragmentation can't run while a domain controller is running. Instead, you must take the domain controller offline and boot it into Directory Services Repair Mode. You can do this by pressing F8 and selecting the corresponding command from the boot menu. When the computer finally boots, make a backup copy of the NTDS.DIT file. This is the actual Active Directory database file for that domain controller. It's a good idea to make a backup in case anything goes wrong. Once the system has been booted normally, and you can confirm that Active Directory is running, you can get rid of the backup copy. I also recommend running this process only if you know that there is probably a lot of empty space in your database. Remember, too, that each domain controller contains a separate copy of the Active Directory database. Therefore, if you find yourself needing to use this technique, you'll probably want to repeat it for each domain controller in the domain. Be sure to do one server at a time, or you could cause some serious problems with the databases.
The next step in the process is to open a Command Prompt window and issue a series of commands that will show you the location of the Active Directory database. The command sequence is:
NTDSUTIL FILES INFO
Once you know the location of the Active Directory database, make a backup of it. You may now begin the Defragmentation process. The process involves creating a brand new, compacted version of the database and then using this copy to replace your previous copy. The commands for doing this are (assuming that the last command you entered was INFO):
COMAPCT TO F: (where F: is the location where you want to temporarily store the new copy) QUIT QUIT ERASE C:WINNTNTDSNTDS.DIT (this command erases your original database and assumes that the original database was located in C:WINNTNTDS ERASE C:WINNTNTDS*.LOG COPY F:NTDS.DIT C:WINNTNTDS
About the author:
Brien Posey, CEO of Posey Enterprises, is a freelance technical writer who has been working with computers for about 15 years. Before going freelance, Brien served as director of information systems at a large, nationwide healthcare company. He has also served as a network engineer/security consultant for the Department of Defense. You can access Brien's Web site, which contains hundreds of his articles and white papers, at http://www.brienposey.com.
This was first published in August 2002