Previous Contents Index DocHome Next |
iPlanet Directory Server Configuration, Command, and File Reference |
Appendix A Using the ns-slapd and slapd.exe Command-Line Utilities
In Chapter 8 "Command-Line Scripts," we looked at the scripts for performing routine administration tasks on the Directory Server. In this Appendix we will look at the ns-slapd (UNIX) and slapd.exe (Windows) command-line utilities that can also be used to perform the same tasks. This chapter contains the following sections:
Overview of ns-slapd and slapd.exe Commands
Finding and Executing the ns-slapd and slapd.exe Command-Line Utilities
ns-slapd and slapd.exe Command-Line Utilities for Exporting Databases
ns-slapd and slapd.exe Command-Line Utilities for Restoring and Backing up Databases
ns-slapd and slapd.exe Command-Line Utilities for Creating and Regenerating Indexes
Overview of ns-slapd and slapd.exe Commands
The ns-slapd and slapd.exe command-line utilities all perform server administration tasks, and while it can be argued that they allow a greater degree of flexibility for users, we still recommend that you use the command-line scripts presented in Chapter 8 "Command-Line Scripts".
ns-slapd (UNIX)
ns-slapd is used on a UNIX operating system to start the directory server process, to build a directory database from an LDIF file, or to convert an existing database to an LDIF file. For more information on starting and stopping the Directory Server, importing from LDIF using the command line, and exporting to LDIF using the command line, see Chapter 3, " Populating Directory Databases" in the iPlanet Directory Server Administrator's Guide.
slapd.exe (Windows NT)
slapd.exe is the ns-slapd Windows NT equivalent
Note You must stop the server before running the ns-slapd and slapd.exe command-line utilities.
Finding and Executing the ns-slapd and slapd.exe Command-Line Utilities
After a default installation, the ns-slapd command line utilities are stored under the following paths and names:
Solaris 9 platform
Windows platforms
Other platforms
Do not mistake ns-slapd.exe, the slapd process watchdog, for slapd.exe on Windows NT.
ns-slapd and slapd.exe Command-Line Utilities for Exporting Databases
db2ldif
Exports the contents of the database to LDIF.
ns-slapd db2ldif -D slapd-serverID -a output_file [-d debug_level] [-n backend_instance] [-r] [-s include_suffix] [-x exclude_suffix] [-N] [-u] -[U] where slapd-serverID is the location of your server configuration directory. Enter the full path to the slapd-serverID directory.
slapd.exe db2ldif -D slapd-serverID -a output_file [-d debug_level] [-n backend_instance] [-r] [-s include_suffix] [-x exclude_suffix] [-N] [-u] [-U]
Note You must specify either the -n or the -s option.
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.
Specifies the debug level to use during the db2ldif runtime. For further information, see "nsslapd-errorlog-level (Error Log Level)" on page 49.
Specifies the server configuration directory that contains the configuration information for the export process. You must specify the full path to the slapd-serverID directory.
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.
Causes the server to include the copiedFrom attribute and its contents in the LDIF output when importing the LDIF file to a consumer server. This information is required by the server by the replication process.
Note that if you use the -r option, you also need to specify the suffix you want to export by using the -s option. You must shut down the server before exporting using this option.
Specifies the suffix or suffixes to include in the export. You may use multiple -s arguments. If you do not specify -s or -x, the server exports all suffixes within the database. If you use both -x and -s arguments with the same suffix, the -x operation takes precedence. Exclusion always takes precedence over inclusion.
Note if you exclude one or more suffixes from the exported LDIF file, and you intend to import the LDIF file into your configuration directory, do not exclude o=NetscapeRoot. If you use -s to specify a suffix to include, and you intend to import the LDIF file into your configuration directory, make sure that you also use -s to include o=NetscapeRoot.
Specifies that the uniqueID will not be included in the LDIF output. By default, the server includes the uniqueID for all entries with a uniqueID in the exported LDIF file.
Use this option if you intend to use the exported LDIF to initialize a 4.x consumer server. However, do not use this option when you are importing into a 5.0 consumer, as it does not cause the server to create a uniqueID for entries but simply takes what already exists in the database.
Outputs the contents of the database without wrapping lines.
Specifies a suffix or suffixes to exclude in the export. You may use multiple -x arguments. If you do not specify -s or -x, the server exports all suffixes within the database. If you use both -x and -s options with the same suffix, the -x operation takes precedence. Exclusion always takes precedence over inclusion. If you intend to import the LDIF file into your configuration directory, do not exclude o=NetscapeRoot.
ns-slapd and slapd.exe Command-Line Utilities for Restoring and Backing up Databases
ldif2db
Imports LDIF files to the database.
ns-slapd ldif2db -D slapd-serverID -i ldif_file [-d debug_level]
[-g string] [-n backend_instance] -O [-s include_suffix] -x exclude_suffix]where ldif_file is the name of the file containing the LDIF to be imported and slapd-serverID is the location of your server configuration directory. You can find a sample LDIF file under installDir/slapd-serverID/ldif. Enter the full path to the slapd-serverID directory, by default:
Solaris 9 platform
Windows platforms
Other platforms
slapd ldif2db -D slapd-serverID -i ldif_file [-d debug_level] [-g string] [-n backend_instance] [-O] [-s include_suffix] [-x exclude_suffix]
Specifies the debug level to use during runtime. For further information, see "nsslapd-errorlog-level (Error Log Level)" on page 49.
Specifies the server configuration directory that contains the configuration information for the import process. You must specify the full path to the slapd-serverID directory.
Generation of 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.
If you use the deterministic generation to have a name-based unique ID, you can also specify the namespace you want the server to use as follows:
where namespace_id is a string of characters in the following format
00-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx
Use this option if you want to import the same LDIF file into two different directory servers, and if you want the contents of both directories to have the same set of unique IDs. If unique IDs already exist in the LDIF file you are importing, then the existing IDs are imported to the server regardless of the options you have specified.
Specifies the LDIF file to be imported. This option is required. You can use multiple -i arguments to import more than one LDIF file at a time. When you import multiple files, the server imports the LDIF files in the order in which you specify them from the command line.
Specifies that no attribute indexes are created for the imported database. If you specify this option and you want to restore the indexes later, you will need to recreate the indexes by hand. See the iPlanet Directory Server Administrator's Guide for further information.
Specifies the suffix or suffixes within the LDIF file you want to import. If you use -s to specify a suffix to include, and you are importing the LDIF file into your configuration directory, make sure that you also use -s to include o=NetscapeRoot. You can use multiple -s arguments. If you use both -x and -s with the same suffix, -x takes precedence. Exclusion always takes precedence over inclusion. If you do not specify -x or -s, then all available suffixes will be imported from the LDIF file.
Allows you to specify suffixes within the LDIF file to exclude during the import. You can use multiple -x arguments. This option lets you selectively import portions of the LDIF file. If you use both -x and -s with the same suffix, -x takes precedence. Exclusion always takes precedence over inclusion. If you do not specify -x or -s, then all available suffixes will be imported from the LDIF file. If you are importing the LDIF file into your configuration directory, do not exclude o=NetscapeRoot.
archive2db
Restores database from the archives.
slapd archive2db -D configdir -a archivedir
slapd archive2db -D configdir -a archivedir
Specifies the server configuration directory that contains the configuration information for the index creation process. You must specify the full path to the slapd-serverID directory.
db2archive
Backs up all databases to the archives.
slapd db2archive -D configdir -a archivedir
slapd db2archive -D configdir -a archivedir
Specifies the server configuration directory that contains the configuration information for the index creation process. You must specify the full path to the slapd-serverID directory.
ns-slapd and slapd.exe Command-Line Utilities for Creating and Regenerating Indexes
db2index
Creates and regenerates indexes.
slapd db2index -D slapd-serverID [-d debug_level] -n backend_name -t attributeName[:indexTypes[:matchingRules]] | [-T VLVTag]
slapd db2index -D slapd-serverID [-d debug_level] -n backend_name -t attributeName[:indexTypes[:matchingRules]] | [-T VLVTag]
Specifies the debug level to use during index creation. For further information see "nsslapd-errorlog-level (Error Log Level)" on page 49.
Specifies the server configuration directory that contains the configuration information for the index creation process. You must specify the full path to the slapd-serverID directory.
Specifies the name of the backend containing the entries to index.
Specifies the attribute to be indexed as well as the types of indexes to create and matching rules to apply (if any). If you want to specify a matching rule, you must specify an index type. You cannot use this option with option -T.
Specifies the VLV tag to use to create VLV indexes. You can use the console to specify VLV tags for each database supporting your directory tree, as described in xref. You can define additional VLV tags by creating them in LDIF, and adding them in the directory server configuration, as described in xref. You cannot use this option with option -t.
A comma separated list of indexes to be created for the attributes.
An optional, comma-separated list of the OIDs for the languages in which you want the attribute to be indexed. This option is used to created international indexes. For information on supported locales and collation order OIDs, see Appendix D, "Internationalization" in the iPlanet Directory Server Administrator's Guide.
Previous Contents Index DocHome Next
Copyright © 2001 Sun Microsystems, Inc. Some preexisting portions Copyright © 2001 Netscape Communications Corp. All rights reserved.
Last Updated October 29, 2001