HP-UX Directory Server Administrator Guide HP-UX Directory Server Version 8.1 (5900-3098, May 2013)

4.3.3.2 Restoring your database from the command line
There are three ways to restore databases from the command line:
Using the bak2db command line script. This script requires the server to be shut down.
Using the bak2db.pl Perl script. This script works while the server is running.
Creating a temporary entry under cn=restore, cn=tasks, cn=config. This method
can also be run while the server is running.
4.3.3.2.1 Using the bak2db command line script
To restore the directory from the command line:
1. If the Directory Server is running, stop it:
/opt/dirsrv/slapd-instance_name/stop-slapd
For more information about the command to start and stop the HP-UX Directory Server,
see“Starting and Stopping Servers” (page 19).
2. Run the bak2db command line script. The bak2db script requires the full path and name of
the input file.
/opt/dirsrv/slapd-instance_name/bak2db \
/var/opt/dirsrv/slapd-instance_name/bak/instance_name-2009_04_30_11_48_30
For more information about using this script, see the HP-UX Directory Server configuration,
command, and file reference.
4.3.3.2.2 Using bak2db.pl Perl script
1. Run the bak2db.pl Perl script.
/opt/dirsrv/slapd-instance_name/bak2db.pl -D "cn=Directory Manager" -w secret \
-a /var/opt/dirsrv/slapd-instance_name/bak/instance_name-2009_04_30_11_48_30
For more information on using this Perl script, see the HP-UX Directory Server configuration,
command, and file reference.
DescriptionOption
Defines the full path and name of the input file.-a
Specifies the DN of the administrative user.-D
Specifies the password of the administrative user.-w
4.3.3.2.3 Restoring the database through the cn=tasks entry
The cn=tasks, cn=config entry in the Directory Server configuration is a container entry for
temporary entries that the server uses to manage tasks. Several common directory tasks have
container entries under cn=tasks, cn=config. Temporary task entries can be created under
cn=restore, cn=tasks, cn=config to initiate a restore operation.
The restore task entry requires three attributes, the same as the backup task:
A unique name (cn)
The directory from which to retrieve the backup file (nsArchiveDir).
The type of database (nsDatabaseType); the only option is ldbm database.
The entry is simply added using ldamodify, as described in Adding and modifying entries using
ldapmodify” (page 112). For example:
ldapmodify -a -D "cn=directory manager" -w secret -p 389 -h server.example.com
dn: cn=example restore, cn=restore, cn=tasks, cn=config
objectClass: top
objectClass: extensibleObject
cn: example restore
4.3 Backing up and restoring data 163