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. Note 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 dirsrv user has write permissions in the destination directory. Note that Directory Server uses its own private directories by default. As a result, backups and exports under directories /var/tmp/ , /tmp/ , and /root/ fail unless you disabled the PrivateTmp systemd directive. The Directory Server instance is running. Procedure Use the dsconf backend export command to export data to an LDIF file. For example, to export the userRoot database: # dsconf -D " cn=Directory Manager " ldap://server.example.com backend export userRoot The export task has finished successfully By default, dsconf stores the export in a file called instance_name_database_name-time_stamp .ldif in the /var/lib/dirsrv/slapd- instance_name /ldif/ directory. Alternatively, add the -l file_name option to the command to specify a different location. Search the /var/log/dirsrv/slapd- instance_name /errors log 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 --help command. 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 dirsrv user has write permissions in the destination directory. Note that Directory Server uses its own private directories by default. As a result, backups and exports under directories /var/tmp/ , /tmp/ , and /root/ fail unless you disabled the PrivateTmp systemd directive. The Directory Server instance is not running. Procedure Use the dsctl db2ldif command to export data to an LDIF file. For example, to export the userRoot database to the /var/lib/dirsrv/slapd- instance_name /ldif/example.ldif file: # dsctl instance_name db2ldif userRoot /var/lib/dirsrv/slapd- instance_name /ldif/example.ldif OK 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 /errors log 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 --help command. 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 dirsrv user has write permissions in the destination directory. Note that Directory Server uses its own private directories by default. As a result, backups and exports under directories /var/tmp/ , /tmp/ , and /root/ fail unless you disabled the PrivateTmp systemd directive. 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. Additional resources Importing data using the web console while the server is running Backing up Directory Server 2.4. Additional resources LDIF Technical Specification - RFC 2849 .

Commands:
dsconf -D " cn=Directory Manager " ldap://server.example.com backend export userRoot The export task has finished successfully
dsctl instance_name db2ldif userRoot /var/lib/dirsrv/slapd- instance_name /ldif/example.ldif OK 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
dsctl instance_name start