Defragmenting the Active Directory Database

PC Repair Tools

Advanced Registry Cleaner PC Diagnosis and Repair

Get Instant Access

You may experience a great amount of white space if you performed a bulk deletion or if the size of your system-state backup is significantly increased because of the white space. Often, removing the Global Catalog role from a domain controller will result in large amounts of white space.

You can determine how much space is recoverable by changing the logging level of the Garbage Collection Agent. Two levels of logging are available:

♦ 0—Only critical events or error events are logged in the directory service log.

♦ 1—High-level events are logged. Event ID 700 is recorded when defragmentation begins, and event ID 701 is recorded when defragmentation ends. Event ID 1646 reports the amount of free space (white space) in the database and the total amount of allocated space.

If you find from this process that you can recover a significant amount of space, you may want to perform an offline defragmentation of the Active Directory database file. To do so, follow these steps:

Changing the Garbage Collection Logging Value

1. Click Start, click Run, type regedit, and then press Enter.

2. In Registry Editor, navigate to Garbage Collection in HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Services\NTDS\Diagnostics.

3. Double-click Garbage Collection; for Base, click Decimal.

4. In the Value data box, type 1, and then click OK.

Backing Up the System State

1. Click Start > Run > Programs > Accessories > System Tools > Backup.

2. On the Welcome to the Backup or Restore Wizard page, click Next.

3. Select Back Up Files and Settings, and then click Next.

4. Select Let Me Choose What to Back Up, and then click Next.

5. In the Items to Back Up window, double-click My Computer.

6. In the expanded list below My Computer, click the box labeled System State, and then click Next.

7. Select a location to store the backup.

8. Type a name for this backup, and then click Next.

9. On the last page of the wizard, click Advanced.

10. Keep the default settings for in the Type of Backup screen. Normal should be selected, and the check box should remain cleared for Backup Migrated Remote Storage Data. Click Next.

11. Select Verify Data after Backup, and then click Next.

12. In the Backup Options dialog box, select a backup option, and then click Next.

13. If you are replacing the existing backups, select the option to allow only the owner and administrator access to the backup data and to any backups that are appended to this medium, and then click Next.

14. In the When to Back Up box, select the appropriate option for your needs, and then click Next.

15. Click Finish to perform the backup operation according to your selected schedule.

Taking the Domain Controller Offline

1. Restart the domain controller.

2. When the screen for selecting an operating system appears, press F8.

3. From the Windows Advanced Options menu, select Directory Services Restore Mode.

4. When prompted, log on as the local administrator.

Performing an Offline Defragmentation

In Directory Services Restore mode, compact the database file to a local directory or remote shared folder, as follows:

1. For a local directory:

♦ At the command prompt, enter ntdsutil and press Enter.

♦ At the ntdsutil: prompt, type files and press Enter.

♦ At the file maintenance: prompt, type compact to drive:\Loca!Path, where drive:\Loca1Path is the path to a location on the local computer—for example, e:\NTDS.

2. For a remote directory:

You must map a drive to the shared folder to which you are copying the files. Because you are logged on as a local administrator, you will probably not have permissions to your remote share. To map the drive and authenticate, you must supply domain administrator credentials when mapping the drive:

♦ Type the command net use drive: \\server\share/userDomainName\Username, where drive: is the drive letter you would like to use for the mapping, server is the remote server name, share is the name of the shared folder, DomainName is the name of your domain, and Username is the name of a user who has rights to that folder.

♦ Type the password for \\server\share that corresponds to the username defined in the command line.

♦ At the command prompt, enter ntdsutil and press Enter.

♦ At the ntdsutil: prompt, type files and press Enter.

♦ At the file maintenance: prompt, type compact to drive:\MappedDrive where drive:\MappedDrive is the path that was created in the steps listed previously—for example, p:\NTDS.

Figure 14.1 shows a screenshot of defragging the Active Directory database.

Figure 14.1

Defragging the Active Directory database

Figure 14.1 shows a screenshot of defragging the Active Directory database.

Defrag Directory Services Server 2008

What Could Go Wrong?

If errors appear when you restart the domain controller, do the following: 1. Restart the domain controller in Directory Services Restore mode.

2. Check the errors in Event Viewer.

You may find Event ID 1046 or 1168 in the Event Viewer. If you find these events, you should respond to them accordingly, as follows:

Event ID 1046 "The Active Directory database engine caused an exception with the following parameters." You cannot recover from this error, and you must restore from backup media.

Event ID 1168 "Internal error: An Active Directory error has occurred." If you see this error message, Active Directory is missing information in the registry and you must restore from backup media.

3. Check database integrity and then proceed as follows:

If the integrity check fails, copy the original version of the Ntds.dit file that you preserved to the original database location and repeat the offline defragmentation procedure.

If the integrity check succeeds, perform semantic database analysis with fixup.

4. If semantic database analysis with fixup succeeds, quit Ntdsutil.exe and restart the domain controller normally.

5. If semantic database analysis with fixup fails, contact Microsoft Product Support Services.

If the database integrity check fails, perform semantic database analysis with fixup. When you run semantic database analysis with the Go Fixup command instead of the Go command, errors are written into Dsdit.dmp.xx log files. A progress indicator reports the status of the check.

To Perform Semantic Database Analysis with fixup

Figure 14.2 shows semantic database analysis with fixup.

1. Open a command prompt.

2. Type the command ntdsutil: and then press Enter.

3. At the ntdsutil: prompt, type semantic database analysis and then press Enter.

Figure 14.2

Semantic database analysis with fixup

Ntdsutil Fixup Error

4. At the semantic checker: prompt, type verbose on and then press Enter.

5. At the semantic checker: prompt, type go fixup and then press Enter.

If errors are reported during the semantic database analysis with fixup, perform a directory database recovery. (The recover and repair commands are not to be confused. Never use the repair command in NTDSUtil, because forestwide data loss can occur.)

If semantic database analysis with fixup is successful, close Ntdsutil.exe, and then restart the domain controller normally.

Was this article helpful?

0 0
Computer Hard Drive Data Recovery

Computer Hard Drive Data Recovery

Learn How To Recover Your Hard Drive Data After A Computer Failure.

Get My Free Ebook


  • saara
    How to restore active directory 2008 1168?
    9 years ago
  • gustavo bellucci
    How do you defragment the active directory database server 2008?
    9 years ago
  • andrea
    How to defrag active directory database in win 2008?
    9 years ago
  • spencer her
    How to recover white space in active directory?
    9 years ago
    How to defrag the active directory database server 2003?
    7 years ago
  • Azzeza
    Is there a windows event ID that shows active directory database size?
    1 year ago

Post a comment