1. Create a .ldif file that contains entries or locate an existing file.
    The import-ldif tool requires a .ldif file, which conforms to standard LDIF syntax without change records. The changeType attribute is not allowed in the input LDIF. For information on adding entries to Directory Server, see Managing Entries.
  2. Stop the Directory Server.
  3. To import data from an LDIF file to the Directory Server, use the import-ldif command.

    For assistance with the list of options, run import-ldif --help.

    In the following example, the data is imported from the data.ldif file to the userRoot backend. Entries rejected due to schema violation are written with the rejection reason to the rejects.ldif file. Skipped entries, written to skipped.ldif, occur if an entry cannot be placed under a branch node in the directory information tree (DIT) or if exclusion filters, such as --excludeBranch, --excludeAttribute, or --excludeFilter are used. The --overwrite option instructs import-ldif to overwrite existing skipped and rejected files. The --overwriteExistingEntries option indicates that any existing data in the backend should be overwritten, and the --stripTrailingSpaces option strips trailing spaces on attributes that would otherwise result in an LDIF parsing error.

    $ bin/import-ldif --backendID userRoot --ldifFile /path/to/data.ldif --rejectFile
        rejects.ldif --skipFile skipped.ldif --overwrite --overwriteExistingEntries --stripTrailingSpaces
  4. Restart the Directory Server.