4.2. Exporting Data
- Backing up the data in the database.
- Copying data to another Directory Server.
- Exporting data to another application.
- Repopulating databases after a change to the directory topology.
cn=config), schema information (
cn=schema), or monitoring information (
Figure 4.1. Splitting a Database Contents into Two Databases
4.2.1. Exporting Directory Data to LDIF Using the Console
- Select the Tasks tab. Scroll to the bottom of the screen, and click Export Database(s).Alternatively, select the Configuration tab and click the Export from the Console menu.
- Enter the full path and filename of the LDIF file in the LDIF File field, or click to locate the file.
- If the Console is running on a machine remote to the server, two radio buttons are displayed beneath the LDIF File field.
- Select To local machine to export the data to an LDIF file on the machine from which the Console is running.
- Select To server machine to export to an LDIF file located on the server's machine.
- To export the whole directory, select the Entire database radio button.To export only a single subtree of the suffix contained by the database, select the Subtree radio button, and then enter the name of the suffix in the Subtree text box. This option exports a subtree that is contained by more than one database.Alternatively, clickto select a suffix or subtree.
4.2.2. Exporting a Single Database to LDIF Using the Console
- Select the Configuration tab.
- Expand the Data tree in the left navigation pane. Expand the suffix, and select the database under the suffix.
- Right-click the database, and select Export Database.Alternatively, select Export Database from the Object menu.
- In the LDIF file field, enter the full path to the LDIF file, or click .When thebutton is not enabled, the file is stored in the default directory,
4.2.3. Exporting to LDIF from the Command Line
- Using db2ldif. This method runs the command-line utility; unlike the import script,
ldif2db, this utility can be run while the server is running.
- Using db2ldif.pl. This Perl script behaves the same as the
db2ldifcommand-line utility and takes the same options.
- Creating a cn=tasks entry. This method creates a temporary task entry which automatically launches an export operation. This is functionally like running
db2ldif, with one exception: when running
db2ldif.plfor a replica (with a
-roption, the server must be stopped first. The
cn=tasksentry can be added and export replica information while the server is still running. See Section 184.108.40.206, “Exporting through the cn=tasks Entry”.
220.127.116.11. Exporting a Database Using db2ldif or db2ldif.pl
db2ldifcommand-line script or the
db2ldif.plPerl script. Both of these tools export all of the database contents or a part of their contents to LDIF when the server is running or stopped.
-Eoption is required to export a database that has been encrypted. See Section 18.104.22.168, “Exporting and Importing an Encrypted Database” for more information.
db2ldifcommand-line script or the
db2ldif.plPerl script. For example:
[root@server ~]# db2ldif -n database1 -a /export/output.ldif
/export/output.ldif. If the
-aoption is not specified, then the database information is exported to
.ldif. For example:
[root@server ~]# db2ldif -n database1
-soption. For example:
[root@server ~]# db2ldif -s "dc=example,dc=com"
-example-2017_04_30_112718.ldif, using the name of the suffix rather than the database.
dc=example,dc=com, then it is not necessary to specify the database or to use the
Table 4.4. db2ldif Options
|-n||Specifies the name of the database from which the file is being exported.|
|-s|| Specifies the suffix or suffixes to include in the export. If the suffix is a root suffix, such as |
|-a|| Defines the output file to which Directory Server exports the LDIF. This file must be an absolute path. If the |
|-r||Specifies that the exported database is a consumer replica. In this case, the appropriate settings and entries are included with the LDIF to initialize the replica when the LDIF is imported.|
|-E||Decrypts an encrypted database so it can be exported.|
22.214.171.124. Exporting through the cn=tasks Entry
cn=tasks,cn=configentry 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=export,cn=tasks,cn=configto initiate an export operation.
- A unique name (
- The filename of the LDIF file to which to export the database (
- The name of the database to export (
-xoptions, respectively, for the
db2ldif.plscripts. Additionally, if the database is a replica, then the appropriate replica information can be included to initialize the new consumer when the LDIF is imported; this is set in the
nsExportReplica, corresponding to the
ldapmodify, as described in Section 3.2.4, “Adding and Modifying Entries Using ldapmodify”. For example:
-a-D "cn=directory manager" -W -p 389 -h server.example.com -x dn: cn=example export,cn=export,cn=tasks,cn=config changetype: add objectclass: extensibleObject cn: example export nsInstance: userRoot nsFilename: /home/files/example.ldif nsExportReplica: true nsIncludeSuffix: ou=People,dc=example,dc=com nsExcludeSuffix: ou=Groups,dc=example,dc=com