A.3. Utilities for Exporting Databases: db2ldif

Exports the contents of the database to LDIF.
Syntax

ns-slapd db2ldif -D configDir -a outputFile [ -d debugLevel ] [ -n backendInstance ] [ -r ] [ -s includeSuffix ] [ -x excludeSuffix ] [ -N ] [ -u ] [ -U ] [ -m ] [ -M ] [ -E ]

With this command, enter the full path to the configuration directory, /etc/dirsrv/slapd-instance. Either the -n or the -s option must be specified.
Options

Table A.1. db2ldif Options

Option Description
-a outputFile Defines the output file in which the server saves the exported LDIF. This file is stored by default in the directory where the command-line utility resides.
-d debugLevel Specifies the debug level to use during the db2ldif runtime. For further information, see Section 3.1.1.76, “nsslapd-errorlog-level (Error Log Level)”.
-D configDir Specifies the location of the server configuration directory that contains the configuration information for the export process. This must be the full path to the configuration directory, /etc/dirsrv/slapd-instance.
-E Decrypts an encrypted database during export. This option is used only if database encryption is enabled.
-m Sets minimal base-64 encoding.
-M Uses several files to store the output LDIF, with each instance stored in instance filename, where filename is the filename specified in option -a.
-n backendInstance Specifies the name of the back end instance to be exported.
-N Specifies that entry IDs are not to be included in the LDIF output. The entry IDs are necessary only if the db2ldif output is to be used as input to db2index.
-r Exports replication state information. The server must be shut down before exporting using this option.
-s includeSuffix Specifies the suffix or suffixes to include in the export. There can be multiple -s arguments.
-u Specifies that the unique ID will not be included in the LDIF output. By default, the server includes the unique ID for all entries with a unique ID in the exported LDIF file. Only use this option to use the exported LDIF to initialize a 4.x consumer server; otherwise, this option does not cause the server to create a unique ID for entries but simply takes what already exists in the database.
-U Outputs the contents of the database without wrapping lines.
-x excludeSuffix Specifies a suffix or suffixes to exclude in the export. There can be multiple -x arguments. If neither -s or -x is not specified, the server exports all suffixes within the database. When using both -x and -s options with the same suffix, the -x operation takes precedence. Exclusion always takes precedence over inclusion. If the LDIF file will be imported into the configuration directory, do not exclude o=NetscapeRoot.