Skip Headers
Oracle® Fusion Middleware Administrator's Guide for Oracle Directory Server Enterprise Edition
11g Release 1 (11.1.1.7.0)

Part Number E28972-01
Go to Documentation Home
Home
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

7 Directory Server Backup and Restore

The data managed by your Directory Server is often imported in bulk. Directory Server Enterprise Edition provides tools for importing and exporting entire suffixes. It also provides tools for making backups of all suffixes at once and for restoring all data from a backup.

Before starting any backup or restore operation, ensure that you design a backup and restore strategy to suit your situation. For more information about the different backup options, considerations to take into account, and guidelines for planning a backup and restore strategy, see Designing Backup and Restore Policies in the Deployment Planning Guide for Oracle Directory Server Enterprise Edition.

This chapter covers the following topics:

7.1 Binary Backup

This section explains how to perform a binary backup of directory data. In addition to the binary backup procedures in this section, you can make a binary copy to use for initializing a suffix in a replication topology. See Initializing a Replicated Suffix by Using Binary Copy.

7.1.1 Backing Up Directory Data Only

A binary data backup saves a copy of your directory data that you can use if the database files later become corrupted or deleted. This operation takes the back up of the database only and does not back up any other data such as configuration data and certificates. If you want to back up the whole Directory Server for disaster recovery, see Disaster Recovery.

Caution:

The maximum period between two backups should not exceed the smaller of repl-purge-delay and repl-cl-max-age. The repl-cl-max-age property specifies the period of time, after which internal purge operations are performed on the change log. The change log maintains a record of updates, which might or might not have been replicated. Get the purge delay information using the following command:

dsconf get-suffix-prop -h host -p port suffix-DN repl-purge-delay repl-cl-max-age

If your backup is performed less frequently than the purge delay, the change log might be cleared before it has been backed up. Changes will therefore be lost if you use the backup to restore data.

The consumer server stores internal information about updates to the replicated suffix contents, and the purge delay parameter, repl-purge-delay, specifies how long it must keep this information. The purge delay determines in part how long replication between the consumer and its master can be interrupted and still recover normally. It is related to the repl-cl-max-age parameter of the change log on its supplier server. The shorter of these two parameters determines the longest time that replication between the two servers can be disabled or down and still recover normally. The default value of 7 days is sufficient in most cases.

All backup procedures described in this section store a copy of the server files on the same host by default. You should then copy and store your backups on a different machine or file system for greater security.

7.1.1.1 To Back Up Your Directory Data

Your Directory Server must be stopped to run the dsadm backup command.

You can use the web interface Directory Service Control Center (DSCC) to perform this task.

Back up your directory data.

$ dsadm backup [ -f FLAG ] ... INSTANCE_PATH ARCHIVE_DIR

For example:

$ dsadm backup /local/dsInst /local/tmp/20091005

Note:

By default, binary backup commands will run a database recovery on the backup databases. See dsadm for disabling this behavior.

You can back up directory data while the server is running by using the command dsconf backup command. However, if changes are made to the directory data while the backup is running, proper recovery will take longer.

Never stop the server during a backup operation.

For more information about the dsadm backup, dsconf backup commands and backup flags, see the dsadm and dsconf man pages.

7.1.1.2 To Back Up the dse.ldif File

When restoring a server, all the configuration data such as certificates, schema, and plugins must contain the same configuration information as when the server was backed up. The following task shows how to back up the dse.ldif file and the rest of the configuration information can be backed up in the same manner.

Back up your dse.ldif configuration file.

$ cp instance-path/config/dse.ldif archive-dir

When you perform the following actions, Directory Server automatically backs up the dse.ldif configuration file in the directory instance-path/config.

  • When you start Directory Server, a backup of the dse.ldif file is created in a file named dse.ldif.startOK.

  • When you make modifications to the cn=config branch, the file is first backed up to a file named dse.ldif.bak in the config directory before the server writes the modifications to the dse.ldif file.

7.1.2 Backing Up a File System

You can back up a file system using dscconf or dsadm. The dsconf command may be useful, for example, when you make regular backups that can easily be scripted and put in place. The dsadm command may be useful when you make less frequent backups, or backups that are not well-suited to scripting. You must also consider other conditions such as whether you require Directory Server to always be processing requests, whether there is a proxy server and load balancer in place, and so forth. Ultimately, choose the method that works in your deployment to meet your specific needs.

7.1.2.1 About Frozen Mode

Enable the frozen mode feature when you use the dsconf command to back up a file system. Frozen mode enables you to stop database updates on disk so that a file system snapshot can be taken safely. You can use frozen mode as an additional measure for ensuring a robust backup.

If the server instance is stopped, frozen mode does not apply.

Your server must not write user data on the disk while the file system backup is in progress. If you are sure that no updates will occur during a certain time frame, make your backup during this time. If you cannot guarantee that there will be no updates, put your server into frozen mode before making a backup.

A server in frozen mode continues to write to the access and errors logs. In a single-server topology, operations received when frozen mode is on result in an LDAP error being returned. The error message logged is the standard error for the database being offline. In a replicated topology, a referral is returned. For frozen mode to work correctly, no other tasks should be running on the databases.

Note that the databases of a server in frozen mode are more stable than those in read-only mode. Unlike frozen mode, read-only mode permits tasks to be created and configuration entries to be modified. When frozen mode is on, all configured databases are taken offline. Any internal operations in progress are notified of the database going offline. LDAP operations in progress are completed, and the database environment is flushed. Subsequent incoming operations, including searches to user data, are refused until frozen mode is set to off. You can, however, search configuration parameters while frozen mode is on.

Frozen mode can be active only when the server is running. Restarting the server instance will also reset frozen mode to off.

7.1.2.2 To Back Up a File System Using dsconf

  1. Put your server into frozen mode.

    $ dsconf set-server-prop -h host -p port read-write-mode:frozen
    
  2. Back up your file system, using a tool appropriate to your file system type.

  3. If your server is in frozen mode, make the server read-write again.

    $ dsconf set-server-prop -h host -p port read-write-mode:read-write
    

    If your server receives replication updates from another server, replication updates will start as soon as frozen mode is turned off.

7.1.2.3 To Back Up a Files System Using dsadm

  1. Stop the Directory Server instance.

    $ dsadm stop instance-path
    
  2. List all directories that comprise the Directory Server instance you want to back up.

    $ dsadm list-instance-dirs instance-path
    

    You can use the output from this command as input for the archive utility you use in the next step.

  3. Back up your file system, using a tool appropriate to your file system type.

  4. Start the Directory Server instance.

    $ dsadm start instance-path
    

7.1.2.4 To Restore the File System

You can use the web interface Directory Service Control Center (DSCC) to perform this task.

  1. Stop your server.

    $ dsadm stop instance-path
    
  2. Restore your file system, using a tool appropriate to your file system type.

  3. Start your server.

    $ dsadm start instance-path
    

7.2 Backing Up to LDIF

Backing up to LDIF allows you to back up directory data to a formatted LDIF file.

7.2.1 Exporting to LDIF

You can back up directory data by exporting the contents of a suffix in the LDIF format. Exporting data can be useful for doing the following:

  • Backing up the data in your server

  • Copying your data to another directory server

  • Exporting your data to another application

  • Repopulating suffixes after a change to your directory topology

The configuration information cannot be exported.

Suffix data can occupy a large amount of disk space, especially files in LDIF format. You can optimize transfer times and disk space by exporting compressed files. When you export suffix data, if the filename of the export file ends with .gz, ODSEE automatically compresses the file. By default the compression level is 3. If you increase the compression level, the CPU usage grows significantly while the files size do not show a comparatively significant shrink.

The level range is a number between 1 and 9. Other values revert to default level 3. Compression level is ignored if the output LDIF does not end with .gz.

Caution:

Do not stop the server while an export operation is in progress.

7.2.1.1 To Export a Suffix to LDIF

You can use the web interface Directory Service Control Center (DSCC) to perform this task.

Use one of the following commands to export a suffix to an LDIF file:

  • If your server is local and stopped, type:

    $ dsadm export instance-path suffix-DN LDIF-file
    

    The dsadm export takes only offline backups.

  • If your server is running (local or remote), type:

    $ dsconf export -h host -p portsuffix-DN LDIF-file
    

    The dsconf export takes only online backups.

The following example uses dsconf export to export two suffixes to a single LDIF file:

$ dsconf export -h host1 -p 1389 ou=people,dc=example,dc=com \
 ou=contractors,dc=example,dc=com /local/dsInst/ldif/export123.ldif

The ldif file will be created on the machine running the server instance not on the machine running the dsconf command.

The dsadm export and dsconf export commands can also be used with the --no-repl option to specify that no replication information is to be exported. The default is that the replicated suffix is exported to an LDIF file with replication information. The resulting LDIF file will contain attribute subtypes that are used by the replication mechanism. This LDIF file can then be imported on the consumer server to initialize the consumer replica, as described in Initializing Replicas

For more information about these commands, see the dsadm and dsconf man pages.

7.3 Binary Restore

The following procedures describe how to restore suffixes in your directory. Your server must have been backed up using the procedures described in Backing Up Directory Data Only. Before restoring suffixes involved in replication agreements, read Restoring Replicated Suffixes.

Caution:

Do not stop the server during a restore operation. Because restoring your server overwrites any existing database files, any modifications that were made to the data since the backup are lost.

7.3.1 To Restore Your Server

You can use the web interface Directory Service Control Center (DSCC) to perform this task.

Use one of the following commands to restore your server:

  • If your server is local and stopped, type:

    $ dsadm restore instance-path archive-dir
    

    For example, to restore a backup from a backup directory, type:

    $ dsadm restore /local/dsInst/ local/ds/bak/2006_07_01_11_34_00
    
  • If your server is running, type:

    $ dsconf restore -h host -p port archive-dir
    

    For example, to restore a backup from a backup directory:

    $ dsconf restore -h host1 -p 1389 /local/dsInst/bak/2006_07_01_11_34_00 
    

    Do not stop the server during a restore operation.

    Note:

    The backup copy must be saved on the server, not on the system that is running the dsconf command.

    After a restore, there is no way to go back to the original server content.

Note:

To save disk space, you can restore server by moving files in place of copying them. You can perform this operation by setting the —f move-archive flag with the dsadm restore or the dsconf restore command. However, if the transaction logs cannot be moved during the copyless restore operation, the copy operation is performed instead.

For this operation to complete successfully, the backup and instance files must be on the same filesystem. If you choose to perform the copyless restore, the server data is overwritten with the data in the backup copy and the backup copy also gets destroyed.

For more information about these commands, see the dsadm and dsconf man pages.

7.4 Restoring Replicated Suffixes

Suffixes that are replicated between supplier servers and consumer servers require special consideration before being restored. If possible, update the suffix through the replication mechanism instead of restoring it from a backup.

When you restore a supplier or hub instance, the server configuration must be the same as it was when the backup was made. To ensure this, restore the dse.ldif file before restoring Directory Server data. Use --safe option while starting the server. For more information, see To Start, Stop, and Restart Directory Server.

This section explains how and when to restore a replica, and how to ensure that it is synchronized with other replicas after the operation. To initialize a replica, see Initializing Replicas.

If you have a large replicated suffix and you want to add many entries and ensure that replication updates are added correctly, see Incrementally Adding Many Entries to Large Replicated Suffixes.

This section contains information about the following:

7.4.1 Restoring the Supplier in a Single-Master Scenario

A suffix that is a single-master supplier contains the authoritative data for the entire replication topology. Therefore, restoring this suffix is equivalent to reinitializing all data in the entire topology. You should restore a single master only if you want to reinitialize all data from the contents of the backup to be restored.

If the single-master data is not recoverable due to an error, consider using the data on one of the consumers because it might contain updates that are more recent than a backup. In this case, you need to export the data from the consumer replica to an LDIF file, and reinitialize the master from the LDIF file.

Whether you restore a backup or import an LDIF file on a master replica, you must then reinitialize all of the hubs and consumer replicas that receive updates from this replica. A message is logged to the supplier servers' log files to remind you that reinitialization of the consumers is required.

7.4.2 Restoring a Supplier in a Multi-Master Scenario

In multi-master replication, the other masters each contain an authoritative copy of the replicated data. You cannot restore an old backup because it might be out of date with the current replica contents. If possible, allow the replication mechanism to bring the master up to date from the contents of the other masters.

If that is not possible, restore a multi-master replica in one of the following ways:

  • The simplest way is not to restore a backup, but to reinitialize the intended master from one of the other masters. This ensures that the latest data is sent to the intended master and that the data will be ready for replication. See Replica Initialization From LDIF.

  • For replicas with millions of entries, it can be faster to make a binary copy to restore a more recent backup of one of the other masters. See Initializing a Replicated Suffix by Using Binary Copy.

  • If you have a backup of your master that is not older than the maximum age of the change log contents on any of the other masters, the backup may be used to restore this master. See To Modify Change Log Settings on a Master Replica for a description of change log age. When the old backup is restored, the other masters will use their change logs to update this master with all modifications that have been processed since the backup was saved.

Regardless of how you restore or reinitialize, the master replica will remain in read-only mode after the initialization. This behavior allows the replica to synchronize with the other masters, after which time you may allow write operations, as described in Restoring a Master in a Multi-Master Scenario.

The advantage of allowing all replicas to converge before allowing write operations on the restored or reinitialized master is that none of the hub or consumer servers will require reinitialization.

7.4.3 Restoring a Hub

This section applies only in situations where the replication mechanism cannot automatically bring a hub replica up to date. Such situations include if the database files become corrupted or if replication has been interrupted for too long. In these cases, you need to restore or reinitialize the hub replica in one of the following ways:

  • The simplest way is not to restore a backup, but to reinitialize the hub from one of the master replicas. This ensures that the latest data is sent to the hub and that the data will be ready for replication. See Initializing a Suffix.

  • For replicas with millions of entries, it can be faster to make a binary copy to restore a more recent backup taken from another hub replicated suffix. See Initializing a Replicated Suffix by Using Binary Copy. If there is no other hub replica to copy, reinitialize the hub as described in the previous item, or restore it as described in the next item, if possible.

  • If you have a backup of your hub that is not older than the maximum age of the change log contents on any of its suppliers, either hub or master replicas, the backup may be used to restore this hub. When the hub is restored, its suppliers will use their change logs to update this hub with all modifications that have been processed since the backup was saved.

Note:

Regardless of how you restore or reinitialize the hub replica, you must then reinitialize all consumers of this hub, including any other levels of hubs.

7.4.4 Restoring a Dedicated Consumer

This section applies only in situations where the replication mechanism cannot automatically bring a dedicated consumer replica up to date. Such situations include if the database files become corrupted or if replication has been interrupted for too long. In these cases, you need to restore or reinitialize the consumer in one of the following ways:

  • The simplest way is not to restore a backup, but to reinitialize the consumer from one of its suppliers, either a master or a hub replica. This ensures that the latest data is sent to the consumer and that the data will be ready for replication. See Replica Initialization From LDIF.

  • For replicas with millions of entries, it can be faster to make a binary copy to restore a more recent backup taken from another consumer replicated suffix. See Initializing a Replicated Suffix by Using Binary Copy. If there is no other consumer to copy, reinitialize the replica as described in the previous item or restore it as described in the next item, if possible.

  • If the backup of your consumer is not older than the maximum age of change log contents on any of its suppliers, either hub or master replicas, the backup may be used to restore this consumer. When the consumer is restored, its suppliers will use their change logs to update the consumer with all modifications that have been processed since the backup was saved.

7.4.5 Restoring a Master in a Multi-Master Scenario

In the case of multi-master replication, other masters may process change operations while a given master is being restored. Therefore, when restoration is complete, the new master must also receive new updates that were not included in the restore data. Because restoring a master might take a significant amount of time, the number of pending updates might also be significant.

To allow convergence of these pending updates, newly restored masters are automatically set to read-only mode for client operations after restoration. This is true only when restoring a master by importing data from an LDIF file at the command line, or by using a backup to perform a binary copy.

Therefore, after restoration, a master in a multi-master configuration will process replication updates and allow read operations, but it will return referrals for all write operations from clients.

To verify that the new master is fully synchronized with the other masters before allowing updates, manually enable updates on an initialized master.

Note:

With master replicas sending referrals because of this new behavior, clients wanting to perform write operations might reach their configured hop limit. You might need to increase the hop limit configuration for clients so they can reach an available master. If all master replicas are initialized or reinitialized, all write operations will fail because no replica will be accepting client updates.

In any case, monitor initialized masters closely, and set the referral attributes appropriately to maximize server response.

7.4.5.1 To Begin Accepting Updates Through the Command Line

You can use the web interface Directory Service Control Center (DSCC) to perform this task.

The following commands can be used in scripts that automate the process of initializing a multi-master replica.

  1. Use the insync tool to ensure that the replica has converged with all other masters.

    Replicas are in sync if the delay between modifications on all servers is zero or if the replica has never had any changes to replicate (delay of -1). For more information, see the insync man page.

  2. Begin accepting updates.

    $ dsconf set-suffix-prop -h host -p port suffix-DN repl-accept-client-update-enabled:on
    

    This command automatically sets the server to read-write mode.

7.5 Disaster Recovery

If you want to back up or restore your Directory Server for disaster recovery purposes, use the following procedures.

7.5.1 To Make a Backup for Disaster Recovery

You can use the web interface Directory Service Control Center (DSCC) to perform this task.

  1. Make a backup of your database files by using the command dsadm backup or dsconf backup.

    Use the procedure in Binary Backup, and store the backup files in a safe place.

  2. Copy the configuration directory instance-path/config to a safe place.

  3. Copy the schema directory instance-path/config/schema to a safe place.

  4. Copy the alias directory instance-path/alias to a safe place.

7.5.2 To Restore for Disaster Recovery

You can use the web interface Directory Service Control Center (DSCC) to perform this task.

Make sure you recover the system on the same hardware configuration. For example, the Solaris SPARC recovery mechanism should be used to restore Directory Server on Solaris SPARC.

  1. Install the same version of Directory Server that you had previously on the host.

  2. Create a server instance by using the dsadm create command.

    The instance-path must be the same as the original instance. See Creating Suffixes.

  3. Restore the configuration directory instance-path /config.

  4. Restore the schema directory instance-path/config/schema .

  5. Restore the alias directory instance-path/alias .

  6. Ensure that the configuration for the restored server is correct.

    For example, the directory structure and plug-in configuration must be the same as on the backed up server.

  7. Restore your database files by using the command dsconf restore.

    Use the procedure in Binary Restore.