A.4. Utilities for Restoring and Backing up Databases: ldif2db

Imports LDIF files to the database.

ns-slapd ldif2db -D configDir -i ldifFile [ -d debugLevel ] [ -g string ] [ -n backendInstance ] [ -O ] [ -s includeSuffix ] [ -x excludeSuffix ] [ -E ]

Enter the full path to the server configuration directory (configdir). ldifFile is the name of the file containing the LDIF to be imported. There is an example LDIF file under the /var/lib/dirsrv/slapd-instance/ldif directory. Either the -n or the -s option must be specified.

Table A.2. ldif2db Options

Option Description
-d debugLevel Specifies the debug level to use during runtime. For further information, see Section, “nsslapd-errorlog-level (Error Log Level)”.
-D configDir Specifies the location of the server configuration directory that contains the configuration information for the import 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.
-g string
Generates a unique ID. Type none for no unique ID to be generated and deterministic for the generated unique ID to be name-based. By default, a time-based unique ID is generated.
When using the deterministic generation to have a name-based unique ID, it is also possible to specify the namespace for the server to use, as follows:
-g deterministic namespaceId
namespaceId is a string of characters in the format 00-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx.
Use this option to import the same LDIF file into two different Directory Servers and the contents of both directories should have the same set of unique IDs. If unique IDs already exist in the LDIF file being imported, then the existing IDs are imported to the server, regardless of the options specified.
-i ldifFile Specifies the LDIF file to be imported. This option is required. There can be multiple -i arguments to import more than one LDIF file at a time. When importing multiple files, the server imports the LDIF files in the order they are specified on the command line.
-n backendInstance Specifies the name of the back end to be imported.
-O Specifies that no attribute indexes are created for the imported database. If this option is specified and the indexes need to be restored later, the indexes have to be recreated by hand. See the Red Hat Directory Server Administration Guide for further information.
-s includeSuffix Specifies the suffix or suffixes within the LDIF file to import.
-x excludeSuffix Specifies suffixes within the LDIF file to exclude during the import. There can be multiple -x arguments. This option can selectively import portions of the LDIF file. If both -x and -s are used with the same suffix, -x takes precedence. Exclusion always takes precedence over inclusion. If -x or -s are not specified, then all available suffixes will be imported from the LDIF file. To import the LDIF file into the configuration directory, do not exclude o=NetscapeRoot.