Chapter 2. Exporting data from Directory Server
Export data from the Directory Server database to an LDIF file using the command line or the web console.
The export operations include only directory data. Export does not include the configuration information (cn=config), schema information (cn=schema), and monitoring information (cn=monitor).
Use the export feature to:
- Copy data to another Directory Server.
- Export data to another application.
- Repopulate databases after a change to the directory topology.
- Split the database.
2.1. Exporting data using the command line while the server is running
To export data while the Directory Server instance is running, use the dsconf backend export command.
Prerequisites
-
The
dirsrvuser has write permissions in the destination directory. - The Directory Server instance is running.
Procedure
Use the
dsconf backend exportcommand to export data to an LDIF file.For example, to export the
userRootdatabase:#
dsconf -D "cn=Directory Manager" ldap://server.example.com backend export userRootThe export task has finished successfullyBy default,
dsconfstores the export in a file calledinstance_name_database_name-time_stamp.ldifin the/var/lib/dirsrv/slapd-instance_name/export/directory. Alternatively, add the-l file_nameoption to the command to specify a different location.-
Search the
/var/log/dirsrv/slapd-instance_name/errorslog for problems during the export.
Additional resources
-
To display all additional settings that you can use to export data, see the output of the
dsconf ldap://server.example.com backend export --helpcommand. - Importing data using the command line while the server is running
- Backing up Directory Server
2.2. Exporting data using the command line while the server is offline
If the Directory Server instance is offline, use the dsctl db2ldif command to export data.
Prerequisites
-
The
dirsrvuser has write permissions in the destination directory. - The Directory Server instance is not running.
Procedure
Use the
dsctl db2ldifcommand to export data to an LDIF file. For example, to export theuserRootdatabase to the/var/lib/dirsrv/slapd-instance_name/example.ldiffile:#
dsctl instance_name db2ldif userRoot /var/lib/dirsrv/slapd-instance_name/example.ldifOK group dirsrv exists OK user dirsrv exists ldiffile: /var/lib/dirsrv/slapd-instance_name/example.ldif [18/Jul/2021:10:46:03.353656777 +0200] - INFO - ldbm_instance_config_cachememsize_set - force a minimal value 512000 [18/Jul/2021:10:46:03.383101305 +0200] - INFO - ldbm_back_ldbm2ldif - export userRoot: Processed 160 entries (100%). [18/Jul/2021:10:46:03.391553963 +0200] - INFO - dblayer_pre_close - All database threads now stopped db2ldif successful-
Search the
/var/log/dirsrv/slapd-instance_name/errorslog for problems during the export. Optional: Start the instance:
#
dsctl instance_name start
Additional resources
-
To display all additional settings that you can use to import data, see the output of the
dsctl db2ldif --helpcommand. - Importing data using the command line while the server is offline
- Backing up Directory Server
2.3. Exporting data using the web console while the server is running
Directory Server supports exporting data using the web console.
Prerequisites
-
The
dirsrvuser has write permissions in the destination directory. - The Directory Server instance is running.
- You are logged in to the instance in the web console.
Procedure
- Open the Database menu.
- Select the suffix entry.
-
Click Suffix Tasks, and select
Export Suffix. -
Enter the name of the LDIF file in which you want to store the export. Directory Server will store the file in the
/var/lib/dirsrv/slapd-instance_name/ldif/directory using the specified file name. - Click Export Database.
- To check the log for problems during the export, open the Monitoring → Logging → Errors Log menu.