How to Restore a Corrupted DHCP Database File

ID: Q173396


The information in this article applies to:

WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

SUMMARY

This article discusses methods that may be used to recover a corrupted Dynamic Host Configuration Protocol (DHCP) database.


MORE INFORMATION

The following event log messages appear on a computer running Windows NT Server versions 3.51 and 4.0 when the DHCP database has been corrupted:

Event ID: 1014
Source: DhcpServer
Description: The Jet database returned the following Error: -510.
-or-

Event ID: 1014
Source: DhcpServer
Description: The Jet database returned the following Error: -1022.
-or-

Event ID: 1014
Source: DhcpServer
Description: The Jet database returned the following Error: -1850.
Using Jet.exe to compact the DHCP database does not resolve the issue.

For additional information, please see the following article in the Microsoft Knowledge Base:

ARTICLE-ID: Q153476
TITLE : DHCP Stops Assigning IP Addresses to Clients

The DHCP database is contained in the Dhcp.mdb file located in the %SystemRoot%\System32\Dhcp folder. The DHCP server uses this file to record and store information concerning active leases and reservations. Most of this information is also contained in the following registry key:


HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services
\DHCPServer\Configuration


NOTE: The above registry key is one path; it has been wrapped for readability.

Whenever the DHCP service shuts down correctly, it makes a backup copy of both the database file (Dhcp.mdb) and the registry key. The backup information from the registry is contained in the file Dhcpcfg. For Windows NT 3.51, the file Dhcp.mdb is located in the %SystemRoot%\System32\Dhcp\Backup\Jet folder. In Windows NT 4.0, the file Dhcp.mdb is located in the %SystemRoot%\System32\Dhcp\Backup\Jet\New folder. Both versions of Windows NT store the Dhcpcfg file in the %SystemRoot%\System32\Dhcp\Backup folder.

WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

For information about how to edit the registry, view the Changing Keys and Values online Help topic in Registry Editor (Regedit.exe). Note that you should make a backup copy of the registry files (System.dat and User.dat) before you edit the registry.

To recover a corrupted DHCP database, use one of the following methods:

Restoring a backup copy of the database file is the recommended method because you will not lose information when you use it.

After you recover your database file using one of the methods above, you will need to reconcile the information between the database file and the registry information.

NOTE: The following steps assume that your DHCP server will not start because of a corrupted DHCP database. If your DHCP server starts, but the database is corrupted, you will then need to begin by stopping the service.

To stop the DHCP server service, type the following at a command prompt:

net stop dhcpserver

Restoring a Backup Copy of the Database

  1. Move the files from your existing DHCP folder to a different location, being careful to keep the DHCP folder structure intact. For example, type the following at a command prompt and press ENTER after each line:

    md c:\Olddhcp
    move %SystemRoot%\system32\DHCP\*.* C:\Olddhcp


  2. Remove the corrupted database file.


  3. Copy the backup database file into the DHCP folder by typing the


following at a command prompt, and then pressing ENTER:

Windows NT 3.51:

copy %SystemRoot%\system32\dhcp\backup\jet\dhcp.mdb
%SystemRoot%\system32\dhcp\dhcp.mdb


Windows NT 4.0:

copy %SystemRoot%\system32\dhcp\backup\jet\new\dhcp.mdb
%SystemRoot%\system32\dhcp\dhcp.mdb


NOTE: The above command lines are continuous lines; they have been wrapped for readability.

You may also choose to restore the Dhcp.mdb file to the %SystemRoot%\System32\Dhcp folder from a tape backup or other backup media.

Because you are using an existing database file, whether you restore it from backup media or the backup folder, you should compress it using the Jetpack utility.

For additional information, please see the following article in the Microsoft Knowledge Base:

ARTICLE-ID: Q145881
TITLE : How to Use Jetpack.exe to Compact a WINS or DHCP Database

The procedure above should allow the service to start, but if your scope information is missing it may be necessary to use a backup copy of the Dhcpcfg registry file to restore your scope and reservation information. Refer to steps 5 through 11 in the "From the New DHCP Server" section of the following article:

Article-ID: Q130642
Title : How to Move a DHCP Database to Another Windows NT Server

Generating a New Database File

  1. Move the files in your existing DHCP folder to a different location, being careful to keep the DHCP folder structure intact. For example, type the following at a command prompt, pressing ENTER after each line:

    md c:\olddhcp
    move %SystemRoot%\system32\dhcp\*.* c:\olddhcp


  2. Select the next step from the following list, depending on which version of Windows NT Server you are using:

    Windows NT Server 3.51:

    Expand a new copy of System.mdb from the original Windows NT Server source media by inserting your original Windows NT Server 3.51 CD into your CD-ROM drive, typing the following at a command prompt, and then pressing ENTER:

    expand D:\I386\System.md_ %SystemRoot%\System32\Dhcp\System.mdb
    where D: is your CD-ROM drive and i386 is your platform.

    Windows NT Server 4.0:

    Restart the DHCP server with an empty DHCP folder. Windows NT 4.0 does not use a System.mdb file.


The procedure above should allow the service to start, but if your scope information is missing, it may be necessary to use a backup copy of the Dhcpcfg registry file to restore your scope and reservation information. Refer to steps 5 through 11 in the "From the New DHCP Server" section of the following article:

ARTICLE-ID: Q130642
TITLE : How to Move a DHCP Database to Another Windows NT Server

Reconciling DHCP Information

After you generate a new database file, you may notice that the scope information is present, but no active leases are displayed. To regain the active leases, you need to reconcile the database with the information in the registry using the following steps:

  1. From DHCP Manager, click your scope, and then click Active Leases on the Scope menu.


  2. In the Active Leases dialog box, click Reconcile.


  3. Click OK. Your active leases will appear in the Active Leases dialog box.


NOTE: When you view the properties for a client lease, the computer name will be listed as the IP address of the lease and an arbitrary hexadecimal value will be listed as the client identifier. These will be replaced with the appropriate information as the clients renew their leases.

Repeat the above procedure for each scope for which you need to reconcile leases.

If your DHCP server is Windows NT Server 4.0 SP2 or later, you should enable IP Conflict Detection as described in the following article:

ARTICLE-ID: Q161430
TITLE : Detecting and Flagging Duplicate IP Addresses


Keywords          : kbnetwork nthowto ntnetserv NTSrv 
Version           : WinNT:3.51,4.0
Platform          : winnt 
Issue type        : kbhowto 

Last Reviewed: January 16, 1999