---
title: Importing data
description: After installing the database, such as userRoot, import data into the database.
component: pingdirectory
version: 11.0
page_id: pingdirectory:pingdirectory_server_administration_guide:pd_ds_importing_data
canonical_url: https://docs.pingidentity.com/pingdirectory/11.0/pingdirectory_server_administration_guide/pd_ds_importing_data.html
revdate: September 13, 2023
page_aliases: ["pd_ds_generate_sample_data.adoc", "pd_ds_import_data_using_offline_import.adoc"]
section_ids:
  steps: Steps
  generating-sample-data: Generating sample data
  about-this-task: About this task
  steps-2: Steps
  example: Example:
  result: Result:
  importing-data-on-the-pingdirectory-server-using-offline-import: Importing data on the PingDirectory server using offline import
  steps-3: Steps
  example-2: Example:
---

# Importing data

After installing the database, such as userRoot, import data into the database.

## Steps

* To add a server to a replicating set:

  1. Perform a `dsreplication enable` operation.

  2. Import the database through the `dsreplication initialize` operation.

* To add a server to a non-replicating set or to add the first server of a future replicating set, import the data with the `bin/import-ldif` tool.

  For more information about the `bin/import-ldif` tool, see [Importing and exporting data](pd_ds_import_export_data.html).

## Generating sample data

The PingDirectory server provides LDIF templates to generate sample entries for initializing your server. You can generate the sample data with the `make-ldif` utility together with template files that come bundled with the `.zip` build, or you can use template files that you create yourself.

### About this task

The templates create sequential entries for testing the PingDirectory server with a range of dataset sizes. The templates are located in `config/MakeLDIF`.

The sample data templates generate a dataset with basic access control privileges that grants anonymous read access to anyone, grants users the ability to modify their own accounts, and grants the admin account full privileges. The templates also include the `uid=admin and ou=People` entries.

### Steps

* To generate randomized sample data, use the `--randomSeed` option with the `make-ldif` command.

  #### Example:

  ```shell
  $ bin/make-ldif --templateFile config/MakeLDIF/example-10k.template \
    --ldifFile /path/to/data.ldif --randomSeed 0
  ```

  |   |                                                                                                                     |
  | - | ------------------------------------------------------------------------------------------------------------------- |
  |   | If the `--randomSeed` option is used with the same seed value, the template always generates the same `.ldif` file. |

  #### Result:

  The command generates 10,000 sample entries and writes them to an output file, `data.ldif`. The random seed generator is set to 0.

* To bypass the `make-ldif` command, use the `--templateFile` option with the `import-ldif` tool.

## Importing data on the PingDirectory server using offline import

### Steps

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 the PingDirectory server, see [Managing Entries](pd_ds_manage_entries.html).

2. Stop the PingDirectory server.

3. To import data from an LDIF file to the PingDirectory 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 because of 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.

   #### Example:

   ```
   $ bin/import-ldif --backendID userRoot --ldifFile /path/to/data.ldif --rejectFile
       rejects.ldif --skipFile skipped.ldif --overwrite --overwriteExistingEntries --stripTrailingSpaces
   ```

4. Restart the PingDirectory server.
