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

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

/usr/iplanet/ds5/bin/slapd/server/ns-slapd

Windows platforms

\iPlanet\Servers\bin\slapd\server\slapd.exe

Other platforms

/usr/iplanet/servers/bin/slapd/server/ns-slapd

Do not mistake ns-slapd.exe, the slapd process watchdog, for slapd.exe on Windows NT.



Caution

In order to execute the command line utilities, you must change to the directory where the command line utilities are stored. Although it is possible to set command path and library path variables to execute the utilities, this is not recommended procedure. You run the risk of disrupting the correct execution of other utilities and of compromising the security of the system, particularly when you have more than one server version installed.





ns-slapd and slapd.exe Command-Line Utilities for Exporting Databases




db2ldif

Exports the contents of the database to LDIF.


Shell syntax (UNIX)


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.


Batch file syntax (NT)


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.




Options

-a

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

Specifies the debug level to use during the db2ldif runtime. For further information, see "nsslapd-errorlog-level (Error Log Level)" on page 49.

-D

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.

-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

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.

-s

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.

-u

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.

-U

Outputs the contents of the database without wrapping lines.

-x

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.

-n

Specifies the name of the backend instance to be exported.



ns-slapd and slapd.exe Command-Line Utilities for Restoring and Backing up Databases




ldif2db

Imports LDIF files to the database.


Shell script syntax (UNIX)


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

/var/ds5/slapd-serverID

Windows platforms

\iPlanet\Servers\slapd-serverID

Other platforms

/usr/iplanet/servers/slapd-serverID


Batch file syntax (NT)


slapd ldif2db -D slapd-serverID -i ldif_file [-d debug_level] [-g string] [-n backend_instance] [-O] [-s include_suffix] [-x exclude_suffix]



Note

You must specify either the -n or the -s option.




Options

-d

Specifies the debug level to use during runtime. For further information, see "nsslapd-errorlog-level (Error Log Level)" on page 49.

-D

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.

-g string

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:

-g deterministic namespace_id

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.

-i

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.

-n

Specifies the name of the backend to be imported.

-O

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.

-s

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.

-x

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.



Caution

If you are importing the LDIF file into your configuration directory, make sure the o=NetscapeRoot suffix and its contents are included in your LDIF file before you import. Do not exclude the suffix o=NetscapeRoot using -s, -x, or combination of the two. The iPlanet Administration Server uses this suffix to store information about installed Netscape Servers. Failure to import o=NetscapeRoot into your configuration directory could force you to reinstall (or restore from backup) all of your Netscape 4.x servers including the Directory Server.




archive2db

Restores database from the archives.


Shell script syntax (UNIX)


slapd archive2db -D configdir -a archivedir


Batch file syntax (NT)


slapd archive2db -D configdir -a archivedir


Options

-D

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.

-a

Specifies the archive directory.


db2archive

Backs up all databases to the archives.


Shell script syntax (UNIX)


slapd db2archive -D configdir -a archivedir


Batch file syntax (NT)


slapd db2archive -D configdir -a archivedir


Options

-D

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.

-a

Specifies the archive directory.



ns-slapd and slapd.exe Command-Line Utilities for Creating and Regenerating Indexes




db2index

Creates and regenerates indexes.


Shell script syntax (UNIX)


slapd db2index -D slapd-serverID [-d debug_level] -n backend_name -t attributeName[:indexTypes[:matchingRules]] | [-T VLVTag]


Batch file syntax (NT)


slapd db2index -D slapd-serverID [-d debug_level] -n backend_name -t attributeName[:indexTypes[:matchingRules]] | [-T VLVTag]

Options

-d

Specifies the debug level to use during index creation. For further information see "nsslapd-errorlog-level (Error Log Level)" on page 49.

-D

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.

-n

Specifies the name of the backend containing the entries to index.

-t

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.

-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.

:indexTypes

A comma separated list of indexes to be created for the attributes.

:matchingRules

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