chap-import-export.xml revision 51607ea01068c9047391e4c8b46bc9dbd0edb7fd
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark<?xml version="1.0" encoding="UTF-8"?>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark<!--
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! CCPL HEADER START
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark !
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! This work is licensed under the Creative Commons
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! Attribution-NonCommercial-NoDerivs 3.0 Unported License.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! To view a copy of this license, visit
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! http://creativecommons.org/licenses/by-nc-nd/3.0/
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! or send a letter to Creative Commons, 444 Castro Street,
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! Suite 900, Mountain View, California, 94041, USA.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark !
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! You can also obtain a copy of the license at
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! trunk/opendj3/legal-notices/CC-BY-NC-ND.txt.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! See the License for the specific language governing permissions
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! and limitations under the License.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark !
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! If applicable, add the following below this CCPL HEADER, with the fields
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! enclosed by brackets "[]" replaced with your own identifying information:
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! Portions Copyright [yyyy] [name of copyright owner]
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark !
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! CCPL HEADER END
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark !
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ! Copyright 2011-2013 ForgeRock AS
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark !
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark-->
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark<chapter xml:id='chap-import-export'
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark xmlns='http://docbook.org/ns/docbook' version='5.0' xml:lang='en'
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark xsi:schemaLocation='http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd'
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark xmlns:xlink='http://www.w3.org/1999/xlink'
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark xmlns:xinclude='http://www.w3.org/2001/XInclude'>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>Importing &amp; Exporting LDIF Data</title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm><primary>Provisioning</primary></indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm><primary>Importing data</primary></indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <primary>Restoring</primary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <secondary>From LDIF</secondary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm><primary>Exporting data</primary></indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm><primary>Backup</primary></indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <primary>LDIF</primary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <secondary>Import</secondary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <primary>LDIF</primary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <secondary>Export</secondary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>LDAP Data Interchange Format provides a mechanism for representing
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark directory data in text format. LDIF data is typically used to initialize
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark directory databases, but also may be used to move data between different
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark directories that cannot replicate directly, or even as an alternative
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark backup format.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>This chapter shows you how to import and export LDIF.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark This chapter also covers creating test data in LDIF format, and manipulating
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark LDIF data with command-line tools.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <section xml:id="generating-ldif">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>Generating Test Data</title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>When you install OpenDJ, you have the option of importing sample
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark data generated during the installation. This procedure demonstrates how to
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark generate LDIF using the <command>make-ldif</command> command.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <procedure xml:id="generate-ldif">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>To Generate Test LDIF Data</title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <primary>Importing data</primary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <secondary>Test data</secondary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The <command>make-ldif</command> command uses templates to provide
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark sample data. Default templates are located in the
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <filename>OpenDJ/config/MakeLDIF/</filename> directory. The
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <filename>example.template</filename> file can be used to create
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark a suffix with entries of the type <literal>inetOrgPerson</literal>. You can
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark do the equivalent in OpenDJ Control Panel (Directory Data &gt; New Base
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark DN... &gt; Import Automatically Generated Example Data).</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Write a file to act as the template for your generated LDIF.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The resulting test data template depends on what data you expect to
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark encounter in production. Base your work on your knowledge of the production
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark data, and on the sample template,
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <filename>OpenDJ/config/MakeLDIF/example.template</filename>, and
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark associated data.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>See <link xlink:href="admin-guide#make-ldif-template-5"
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark xlink:role="http://docbook.org/xlink/role/olink" xlink:show="new"><citetitle
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark >make-ldif.template</citetitle></link> for reference information about
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark template files.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Create additional data files for the content in your template to be
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark selected randomly from a file, rather than generated by an expression.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Additional data files are located in the same directory as your
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark template file.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Decide whether you want to generate the same test data each time
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark you run the <command>make-ldif</command> command with your template.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>If so, provide the same <literal>randomSeed</literal> integer each
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark time you run the command.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Before generating a very large LDIF file, make sure you have enough
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark space on disk.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Run the <command>make-ldif</command> command to generate your
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark LDIF file.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <screen>$ make-ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --randomSeed 0
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --templateFile /path/to/my.template
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --ldifFile /path/to/generated.ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkProcessed 1000 entries
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkProcessed 2000 entries
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark...
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkProcessed 10000 entries
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkLDIF processing complete. 10003 entries written</screen>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </procedure>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </section>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <section xml:id="importing-exporting-ldif">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>Importing &amp; Exporting Data</title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>You can use the OpenDJ Control Panel to import data (Directory
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark Data &gt; Import LDIF...) and to export data (Directory Data &gt; Export
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark LDIF...). The following procedures demonstrate how to use the
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <command>import-ldif</command> and <command>export-ldif</command>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark commands.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <procedure xml:id="import-ldif">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>To Import LDIF Data</title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The most efficient method of importing LDIF data is to take the
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark OpenDJ server offline. Alternatively, you can schedule a task to import
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark the data while the server is online.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step performance="optional">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>If you do not want to use the default <literal>userRoot</literal>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark backend, create a new JE backend for your data.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>See <xref linkend="create-database-backend" /> for details.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The following example imports <literal>dc=example,dc=org</literal>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark data into the <literal>userRoot</literal> backend, overwriting existing
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark data.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <stepalternatives>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>If you want to speed up the process&#8212;for example because you
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark have millions of directory entries to import&#8212;first shut down the
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark server, and then run the <command>import-ldif</command> command.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <screen>$ stop-ds
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark$ import-ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --includeBranch dc=example,dc=org
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --backendID userRoot
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --ldifFile /path/to/generated.ldif</screen>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>If not, schedule a task to import the data while online.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <screen>$ import-ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --port 4444
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --hostname opendj.example.com
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --bindDN "cn=Directory Manager"
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --bindPassword password
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --includeBranch dc=example,dc=org
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --backendID userRoot
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --ldifFile /path/to/generated.ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --trustAll</screen>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Notice that the task is scheduled through communication over SSL on
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark the administration port, by default <literal>4444</literal>. You can
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark schedule the import task to start at a particular time using the
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <option>--start</option> option.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The <option>--trustAll</option> option trusts all SSL certificates,
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark such as a default self-signed certificate used for testing.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </stepalternatives>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </procedure>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <procedure xml:id="export-ldif">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>To Export LDIF Data</title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The following example exports <literal>dc=example,dc=org</literal>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark data from the <literal>userRoot</literal> backend.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <stepalternatives>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>If you want to speed up export, first shut down the server, and then
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark export data using the <command>export-ldif</command> command.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <screen>$ stop-ds
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark$ export-ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --includeBranch dc=example,dc=org
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --backendID userRoot
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --ldifFile /path/to/backup.ldif</screen>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>If not, schedule a task to export the data while online.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <screen>$ export-ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --port 4444
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --hostname opendj.example.com
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --bindDN "cn=Directory Manager"
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --bindPassword password
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --includeBranch dc=example,dc=org
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --backendID userRoot
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --ldifFile /path/to/backup.ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --start 20111221230000
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --trustAll</screen>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The <option>--start 20111221230000</option> option tells OpenDJ to
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark start the export at 11 PM on December 21, 2012.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>If OpenDJ is stopped at this time, then when you start OpenDJ again,
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark the server attempts to perform the task after starting up.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </stepalternatives>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </step>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </procedure>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </section>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <section xml:id="ldif-tools">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>Other Tools For Working With LDIF Data</title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <primary>LDIF</primary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <secondary>Tools</secondary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>This section demonstrates the <command>ldifsearch</command>,
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <command>ldifmodify</command>, and <command>ldif-diff</command> tools.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <section xml:id="ldifsearch-example">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>Searching in LDIF With <command>ldifsearch</command></title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The <command>ldifsearch</command> command lets you search LDIF files
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark in a similar way to how you search LDAP directories with the
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <command>ldapsearch</command> command.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <screen>$ ldifsearch
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --baseDN dc=example,dc=org
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --ldifFile generated.ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark "(sn=Grenier)"
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark mobile
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkdn: uid=user.4630,ou=People,dc=example,dc=org
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkmobile: +1 728 983 6669</screen>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The <option>--ldifFile <replaceable>ldif-file</replaceable></option>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark option replaces the <option>--hostname</option> and <option>--port</option>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark options used to connect to an LDAP directory. Otherwise the command syntax
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark and LDIF output is familiar to <command>ldapsearch</command> users.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </section>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <section xml:id="ldifmodify-example">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>Updating LDIF With <command>ldifmodify</command></title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The <command>ldifmodify</command> command lets you apply changes to
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark LDIF files, generating a new, changed version of the original file.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <screen>$ cat changes.ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkdn: uid=user.0,ou=People,dc=example,dc=org
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkchangetype: modify
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkreplace: description
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkdescription: This is the new description for Aaccf Amar.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark-
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkreplace: initials
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkinitials: AAA
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark$ ldifmodify
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --sourceLDIF generated.ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --changesLDIF changes.ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --targetLDIF new.ldif</screen>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Notice that the resulting new LDIF file is likely to be about the
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark same size as the source LDIF file.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </section>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <section xml:id="ldif-diff-example">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>Comparing LDIF With <command>ldif-diff</command></title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>The <command>ldif-diff</command> command reports differences between
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark two LDIF files in LDIF format.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <screen>$ ldif-diff --sourceLDIF old.ldif --targetLDIF new.ldif
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkdn: uid=user.0,ou=People,dc=example,dc=org
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkchangetype: modify
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkadd: initials
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkinitials: AAA
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark-
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkdelete: initials
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkinitials: ASA
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark-
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkadd: description
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkdescription: This is the new description for Aaccf Amar.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark-
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkdelete: description
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkdescription: This is the description for Aaccf Amar.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark</screen>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>As the <command>ldif-diff</command> command reads both files into
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark memory, constructing tree maps to perform the comparison, the command
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark is designed to work with small files and fragments. The command can quickly
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark run out of memory when calculating differences between large files.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </section>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </section>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <section xml:id="create-database-backend">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>Creating a New Database Backend</title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <primary>Database backend</primary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <secondary>Creating</secondary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>OpenDJ stores your data in a <firstterm>backend</firstterm>. OpenDJ
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark stores directory data in backends. Backends are what you backup and restore.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark By default, OpenDJ stores your data in a backend named
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <literal>userRoot</literal>. You can create new backends using the
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <command>dsconfig</command> command. The following example creates a
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark local backend named <literal>testData</literal>.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <screen>$ dsconfig create-backend --backend-name testData --type local-db
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark&gt;&gt;&gt;&gt; Configuring the "base-dn" property
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark Specifies the base DN(s) for the data that the backend handles.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark A single backend may be responsible for one or more base DNs. Note that no
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark two backends may have the same base DN although one backend may have a
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark base DN that is below a base DN provided by another backend (similar to
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark the use of sub-suffixes in the Sun Java System Directory Server). If any
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark of the base DNs is subordinate to a base DN for another backend, then all
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark base DNs for that backend must be subordinate to that same base DN.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark Syntax: DN
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkEnter a value for the "base-dn" property: dc=example,dc=org
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkEnter another value for the "base-dn" property [continue]:
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark&gt;&gt;&gt;&gt; Configuring the "enabled" property
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark Indicates whether the backend is enabled in the server.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark If a backend is not enabled, then its contents are not accessible when
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark processing operations.
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkSelect a value for the "enabled" property:
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 1) true
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 2) false
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ?) help
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark q) quit
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkEnter choice: 1
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark&gt;&gt;&gt;&gt; Configure the properties of the Local DB Backend
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark Property Value(s)
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark --------------------------------------
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 1) backend-id testData
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 2) base-dn "dc=example,dc=org"
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 3) compact-encoding true
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 4) db-cache-percent 10
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 5) db-cache-size 0 b
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 6) db-directory db
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 7) enabled true
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 8) index-entry-limit 4000
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark 9) writability-mode enabled
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark ?) help
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark f) finish - create the new Local DB Backend
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark q) quit
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkEnter choice [f]:
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmarkThe Local DB Backend was created successfully</screen>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Alternatively, you can create a new backend in OpenDJ Control Panel
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark (Directory Data &gt; New Base DN... &gt; Backend &gt; New Backend:
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <replaceable>backend-name</replaceable>).</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </section>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <section xml:id="delete-database-backend">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <title>Deleting a Database Backend</title>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <primary>Database backend</primary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <secondary>Deleting</secondary>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </indexterm>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>You delete a database backend by using the <command>dsconfig
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark delete-backend</command> command.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>When you delete a database backend by using the <command>dsconfig
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark delete-backend</command> command, OpenDJ does not actually remove the
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark database files for two reasons. First, a mistake could potentially cause
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark lots of data to be lost. Second, deleting a large database backend could
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark cause severe service degradation due to a sudden increase in I/O load.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>Instead, after you run the <command>dsconfig delete-backend</command>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark command you must also manually remove the database backend files.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <para>If you do run the <command>dsconfig delete-backend</command> command by
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark mistake and have not yet deleted the actual files, then you can recover from
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark the mistake by creating the backend again, reconfiguring the indexes that
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark were removed, and rebuilding the indexes as described in the section on <link
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark xlink:href="admin-guide#configure-indexes"
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark xlink:role="http://docbook.org/xlink/role/olink"><citetitle>Configuring &amp;
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark Rebuilding Indexes</citetitle></link>.</para>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </section>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark</chapter>