Copy the directory database and log files to a remote share

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

When copying any database files from the local computer, always copy both the database file and the log files.

If you need to move the database file or the log files while you reconfigure the drive on which they are currently stored, and you do not have sufficient space to move the files locally, then you can use the xcopy command to copy the files to a remote shared folder temporarily, and then use the same procedure to copy them back to the original drive. You can use this method as long as the path to the files does not change.

Important

When relocating any database files (the database file or the log files) off the local computer, always copy both the database file and the log files so that all of the files necessary to restore the directory service are maintained.

Administrative Credentials

To perform this procedure, you must provide the Directory Services Restore Mode password for the local administrator account.

To copy the directory database and log files to a remote share and back to the local computer

  1. In Directory Services Restore Mode, open a command prompt and change directories to the current location of the database file (Ntds.dit) or the log files. If the database file and log files are in different locations, perform step 2 for each directory.

  2. Run the dir command and make a note of the current size and location of the Ntds.dit file and the log files.

  3. Establish a network connection to a shared folder, as shown below. Because you are logged on as the local administrator, unless permissions on the shared folder include the built-in Administrator account, you must provide a domain name, user name, and password for an account that has Write permissions on the shared folder.

    In the example below, \\SERVER1\NTDS is the name of the shared folder. K: is the drive that you have mapped to the shared folder. Example text that describes information that you type is shown in bold. After typing the first line and pressing ENTER, you are prompted for the password. Type the password and then press ENTER.

    **H:\>net use K: \\SERVER1\NTDS /user:**domainName\userName *

    Type the password for \\SERVER1\NTDS:

    Drive K: is now connected to \\SERVER1\NTDS

    The command completed successfully.

  4. Use the xcopy command to copy the database file and log files to the location you established in step 3. In the example where the database file is located in H:\WINNT\NTDS and the share has the subdirectory database, the text you type is shown in bold:

    H:>xcopy WINNT\NTDS K:\DB

    The command copies the contents of WINNT\NTDS to the subfolder database in the shared folder described as drive K:. If the database file and log files are in different locations, repeat the xcopy command for the log files, specifying the subfolder for the log files.

  5. Change drives to the new location and run the dir command to compare the file sizes to those listed in step 2. Use this step to ensure that you copy the correct set of files back to the local computer.

  6. At this point, you can safely destroy data on the original local drive.

  7. After the destination drive is prepared, re-establish a connection to the network drive as described in step 3, if necessary.

  8. Copy the database and log files from the remote shared folder back to the original location on the domain controller.

  9. At the command prompt, type ntdsutil and then press ENTER.

  10. At the ntdsutil: prompt, type files and then press ENTER.

  11. At the file maintenance: prompt, type integrity and then press ENTER.

  12. If the integrity check fails, perform semantic database analysis with a fixup record.

  13. If the integrity check succeeds, type quit and press ENTER to quit the file maintenance: prompt. Type quit again and press ENTER to quit Ntdsutil.exe.

  14. Restart the domain controller normally. If you are performing this procedure remotely over a Terminal Services connection, be sure that you have modified the Boot.ini file for normal restarting before you restart the domain controller.

If errors appear when you restart the domain controller:

  1. Restart the domain controller in Directory Services Restore Mode.

  2. Check the errors in Event Viewer.

    If the following events are logged in Event Viewer on restarting the domain controller, respond to the events as follows:

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

    • Event ID 1168. “Internal error: An Active Directory error has occurred.” In this case, information is missing from the registry and you must restore from backup media.