Directory server backup methods

You can use various commands to back up and restore a directory server instance. Based on your requirements, you must choose the appropriate command to back up and restore a directory server.

There are several ways to back up and restore a directory server instance, each with its own set of advantages and disadvantages.

idsdbback and idsdbrestore
The idsdbback and idsdbrestore commands are provided by IBM® Security Directory Server to back up a directory server instance. When you back up, both DB2® database and directory server configuration files are backed up. The advantages of using these commands are in backing up and restoring of the directory server configuration. To know more about these commands, see IBM Security Directory Server Command Reference.
The other backup options that are provided with IBM Security Directory Server do not include the directory server configuration information. The directory server configuration information includes directory schema, configuration file, and key stash file. Although, it is possible to back up these files manually; the idsdbback and idsdbrestore commands make this task easier.
The disadvantage of using the idsdbback and idsdbrestore commands is less flexibility in how the underlying DB2 restore is done. For example, with the idsdbrestore command, the DB2 restore cannot be directed to distribute the database across multiple disks.
db2lif, ldif2db, and bulkload
The db2ldif and ldif2db commands are provided by IBM Security Directory Server to export data from a database to a Lightweight Directory Interchange Format (LDIF) file. You can also use the commands to import the data into the database from the LDIF file. The advantage to using these commands is the portability, standardization, and size factors that they provide.
The output LDIF file can be used to restore a directory server on a different operating system. Because the LDIF format is text-based, it is relatively easy to modify an LDIF file.
The disk space that is required for an LDIF file with entries is considerably less than the space required for a DB2 backup with the entries. The disk space requirement for the LDIF output from db2ldif is approximately six times less than the backed up database from db2 backup or idsdbback. The disadvantage with db2ldif and ldif2db is the time that is required to complete the process, which is more when compared to db2 backup and db2 restore.
For restoring the database, the bulkload command is many times faster than the ldif2db command, but is still much slower than db2 restore. It is because the db2 backup and db2 restore commands are essentially a disk copy, and they are the fastest alternative.
Unlike db2 restore, to restore a directory server by using bulkload, the directory server must be empty. It can be accomplished by restoring an empty database, or by unconfiguring, and then reconfiguring the directory server. It is not advisable to drop the database and re-create it using DB2 commands. Creating the database manually misses some important configuration steps that are part of Configuration Tool.
db2 backup and db2 restore
The db2 backup and db2 restore commands are provided by DB2. The advantage of using these commands is the performance and flexibility in specifying the location of the database files. The db2 restore command can be used to distribute the database across multiple disks or to move the database to another directory. For more information, see Distributing the database across multiple physical disks.
A disadvantage of the db2 backup and db2 restore commands are their complexity. Another disadvantage is the potential incompatibility in backing up and restoring across operating systems and across DB2 versions. For more information, see the appropriate DB2 backup and restore documentation.
An important consideration when you use the db2 backup and db2 restore commands is the preservation of DB2 configuration parameters and system statistics optimizations in the backed-up database. The restored database has the same performance optimizations as the backed-up database. When you use the LDAP commands db2ldif, ldif2db, or bulkload, the performance optimization might not be restored.
If you restore over an existing database, any performance optimization on that existing database is lost. Check all DB2 configuration parameters after you restore the directory server instance. If you do not know whether db2 runstats was run before the database was backed up, tune the DB2 system statistics after the restore (see Update the DB2 system statistics). Use the following DB2 commands to run backup and restore operations:
db2 force applications all 
db2 backup db ldapdb2 to directory_or_device 
db2 restore db ldapdb2 from directory_or_device replace existing
Where, directory_or_device is the name of a directory or device where the backup is stored.
One of the most common errors that occurs during a restore operation is a file permission error. The error might occur due to the following reasons:
  • The DB2 instance owner does not have permission to access the specified directory and file. One way to solve this issue is to change directory and file ownership to the DB2 instance owner. For example, enter the following command:
    chown ldapdb2 file_or_dev
  • The backed-up database is distributed across multiple directories, and those directories do not exist on the target system of the restore. Distributing the database across multiple directories is accomplished with a redirected restore. To solve this problem, create the same directories on the target system or run a redirected restore to specify the directories on the new system. If you create the same directories, ensure that the owner of the directories is the DB2 instance owner typically, the ldapdb2 user. For more information about redirected restore, see Distributing the database across multiple physical disks.