Exit Print View

Sun OpenDS Standard Edition 2.0 Administration Guide

Get PDF Book Print View
 

Document Information

Configuring the Directory Server

Configuring Security in the Directory Server

Managing Directory Data

Importing and Exporting Data

Populating a Stand-Alone Directory Server With Data

Importing Data Using import-ldif

To Import Data in Offline Mode

To Replace Existing Data During an Offline Import

To Append Imported Data to Existing Data

To Import Fractional Files

To Import Fractional Files by Using Filters

To Include or Exclude Attributes During Import

To Import a Compressed LDIF File

To Record Rejected or Skipped Entries During Import

To Import Data From a MakeLDIF Template

To Run an Import in Online Mode

To Schedule an Import

Exporting Data Using export-ldif

To Export Data to LDIF

To Export Partial Data

To Export Part of a Back End by Using Filters

To Include or Exclude Attributes During Export

To Export to LDIF and Then Compress the File

To Run an Export in Online Mode

To Schedule an Export

Importing and Exporting Entries With the Control Panel

To Import Entries With the Control Panel

To Export Entries to an LDIF File With the Control Panel

Creating MakeLDIF Template Files

The Template File Format

make-ldif Template File Tags

Defining Custom Tags

Backing Up and Restoring Data

Overview of the Backup and Restore Process

Backing Up Data

To Back Up All Back Ends

To Back Up All Back Ends with Encryption and Signed Hashes

To Perform an Incremental Backup on All Back Ends

To Back Up a Specific Back End

To Perform an Incremental Backup on a Specific Back End

To Schedule a Backup as a Task

Backing Up the Server Configuration

Backing Up for Disaster Recovery

To Back Up the Directory Server For Disaster Recovery

Restoring Data

To Restore a Back End

To Restore a Back End From Incremental Backups

To Schedule a Restore as a Task

To Restore the Configuration File

To Restore a Directory Server During Disaster Recovery

Restoring Replicated Directory Servers

Backing Up and Restoring Directory Data With the Control Panel

To Back Up Data With the Control Panel

To Restore Data With the Control Panel

Searching Directory Data

Overview of the ldapsearch Command

ldapsearch Location and Format

Understanding Search Criteria

ldapsearch Examples

To Return All Entries

To Search For a Specific User

To Search for Specific User Attributes

To Perform a Search With Base Scope

To Perform a Search With One-Level Scope

To Perform a Search With Subtree Scope

To Return Attribute Names Only

To Return User Attributes Only

To Return Base DNs Only

To Search For Specific Object Classes

To Return a Count of All Entries in the Directory

To Perform a Search With a Compound Filter

To Perform a Search Using a Filter File

To Limit the Number of Entries Returned in a Search

Using Advanced Search Features

Searching for Special Entries and Attributes

To Search for Operational Attributes

To Search the Root DSE Entry

To Search for ACI Attributes

To Search the Schema Entry

To Search the Configuration Entry

To Search the Monitoring Entry

Searching Over SSL

To Search Over SSL With Blind Trust

To Search Over SSL Using a Trust Store

To Search Over SSL With No Trust Store

To Search Over SSL Using a Keystore

To Search Using StartTLS

To Search Using SASL With DIGEST-MD5 Client Authentication

To Search Using SASL With the GSSAPI Mechanism

To Search Using SASL With the PLAIN Mechanism

Searching Using Controls

To View the Available Controls

To Search Using the Account Usability Request Control

To Search Using the Authorization Identity Request Control

To Search Using the Get Effective Rights Control

To Search Using the LDAP Assertion Control

To Search Using the LDAP Subentry Control

To Search Using the Manage DSA IT Control

To Search Using the Matched Values Filter Control

To Search Using the Password Policy Control

To Search Using the Persistent Search Control

To Search Using the Proxied Authorization Control

To Search Using the Server-Side Sort Control

To Search Using the Simple Paged Results Control

Searching Using the Virtual List View Control

To Search Using the Virtual List View Control

To Search Using Virtual List View With a Specific Target

To Search Using Virtual List View With a Known Total

Searching in Verbose Mode and With a Properties File

To Search in Verbose Mode

To Search Using a Properties File

Searching Internationalized Entries

Adding, Modifying, and Deleting Directory Data

Adding Directory Entries

To Create a Root Entry

To Add an Entry Using the --defaultAdd Option With ldapmodify

To Add Entries Using an LDIF Update Statement With ldapmodify

Adding Attributes

To Add an Attribute to an Entry

To Add an ACI Attribute

To Add an International Attribute

Modifying Directory Entries

To Modify an Attribute Value

To Modify an Attribute With Before and After Snapshots

To Delete an Attribute

To Change an RDN

To Move an Entry

Deleting Directory Entries

To Delete an Entry With ldapmodify

To Delete an Entry With ldapdelete

To Delete Multiple Entries by Using a DN File

Indexing Directory Data

Configuring Indexes on the Local DB Back End

To Create a New Local DB Index

Configuring VLV Indexes

To Create a New VLV Index

Managing Indexes With the Control Panel

To Display a List of Indexes

To Add an Index

To Add a VLV Index

To Delete an Index

To Verify Indexes

To Rebuild Indexes

Reducing Stored Data Size

To Enable or Disable Compact Encoding

To Enable or Disable Entry Compression

Managing Directory Data With the Control Panel

Managing Entries With the Control Panel

To Display A List of All Directory Entries

To Add a New Entry With the Control Panel

To Add a New Entry From an LDIF Specification With the Control Panel

To Change the Values of an Entry's Attributes With the Control Panel

To Delete an Entry With the Control Panel

Managing Base DNs With the Control Panel

Adding a New Base DN

Deleting a Base DN

Copying an Entry's DN to the Clipboard

Managing Users

To Reset a User's Password

To Create a Group

To Add a User to a Group

Deleting a Back End With the Control Panel

To Delete a Back End With the Control Panel

Selecting a View of Entry Data

To Select a View of Entry Data

Ensuring Attribute Value Uniqueness

Overview of the Unique Attribute Plug-In

Configuring the Unique Attribute Plug-In Using dsconfig

To Ensure Uniqueness of the Value of the uid Attribute

To Ensure Uniqueness of the Value of Any Other Attribute

Replication and the Unique Attribute Plug-In

Configuring Virtual Attributes

To List the Existing Virtual Attributes

To Create a New Virtual Attribute

To Enable or Disable a Virtual Attribute

To Display the Configuration of a Virtual Attribute

To Change the Configuration of a Virtual Attribute

Configuring Referrals

Configuring LDAP URLs

To Create a Referral

To Modify a Referral

To Delete a Referral

Controlling Access To Data

Replicating Data

Managing Users and Groups

Directory Server Monitoring

Improving Performance

Advanced Administration

Importing Data Using import-ldif

The import-ldif command is used to populate a directory server back end with data read from an LDIF file or with data generated based on a Creating MakeLDIF Template Files. In most cases, import-ldif is significantly faster than adding entries using ldapmodify.

The import-ldif command supports both LDIF files and compressed files (.zip).


Note -


You do not need root privileges to import an LDIF file, but you must authenticate as a user with root permissions, such as cn=Directory Manager.

import-ldif Operation Modes

The import-ldif command has two modes of operation: online and offline.

To Import Data in Offline Mode

This procedure imports a back-end database with new entries specified in an import LDIF file. The command runs in offline mode, which requires the server to be shut down prior to import.

  1. Stop the server if it is running.
    $ stop-ds
  2. Import the LDIF file, as shown in the following example:
    $ import-ldif -b dc=example,dc=com -n userRoot -l Example.ldif

    This command specifies the base DN for the branch of the data that should be included in the import (-b), the back-end ID into which the data is imported (-n), and the LDIF file used for the import (-l).

To Replace Existing Data During an Offline Import

The following procedure replaces an existing back-end with new entries specified in an import file.

  1. Stop the server if it is running.
    $ stop-ds
  2. Import the LDIF file, replacing the existing data. For example:
    $ import-ldif --includeBranch dc=example,dc=com --backendID userRoot \
      --replaceExisting --ldifFile Example.ldif

To Append Imported Data to Existing Data

The following procedure appends the entries in an import file to the existing entries in the back end.

  1. Stop the server if it is running.
    $ stop-ds
  2. Import the LDIF file, appending the new data to the existing data. For example:
    $ import-ldif --backendID userRoot --append --ldifFile new.ldif

To Import Fractional Files

The import-ldif command provides options to import a portion of an import file by specifying the base DN to include or exclude during the process.

This example imports all entries below the base DN, dc=example,dc=com, and excludes all entries below ou=People,dc=example,dc=com.

  1. Stop the server if it is running.
    $ stop-ds
  2. Import a portion of the LDIF file. For example:
    $ import-ldif --includeBranch dc=example,dc=com \
      --excludeBranch ou=People,dc=example,dc=com --backendID userRoot --replaceExisting \
      --ldifFile Example.ldif

To Import Fractional Files by Using Filters

The import-ldif command provides options to import part of an import file by using filters for data inclusion or exclusion. Make sure that you fully understand how this mechanism works before you use it.

In this example, the contents of an LDIF file are imported, except those entries that match the search filter l=Auckland (that is, location=Auckland).


Note - The --includeFilter option works in a similar manner to --excludeFilter, except that it includes all entries that match the search filter during import.


  1. Stop the server if it is running.
    $ stop-ds
  2. Import a portion of the file by using an exclude filter. For example:
    $ import-ldif --excludeFilter "(l=Auckland)" --backendID userRoot \
      --replaceExisting --ldifFile Example.ldif

To Include or Exclude Attributes During Import

The import-ldif command provides options to include and exclude attributes during import by using the --includeAttribute and --excludeAttribute options, respectively. Make sure that you fully understand how this mechanism works before you use it.

  1. Stop the server if it is running.
    $ stop-ds
  2. (Optional) View the entries of the import file before you start the import.

    The directory server provides useful utilities to search, modify, compare, or delete import files without connecting to the server. You can use the ldifsearch command to display an entry in your import file. For example, to display the entry for Sam Carter, use the following command:

    $ ldifsearch -b dc=example,dc=com --ldifFile Example.ldif "(cn=Sam Carter)"
    dn: uid=scarter,ou=People,dc=example,dc=com
    objectClass: person
    objectClass: inetOrgPerson
    objectClass: organizationalPerson
    objectClass: top
    givenname: Sam
    uid: scarter
    cn: Sam Carter
    telephonenumber: +1 408 555 4798
    sn: Carter
    userpassword: sprain
    roomnumber: 4612
    mail: scarter@example.com
    l: Sunnyvale
    ou: Accounting
    ou: People
    facsimiletelephonenumber: +1 408 555 9751

    In this entry, notice the presence of the roomnumber attribute below the telephonenumber attribute.

  3. Import the file, excluding the roomnumber attribute for all entries.
    $ import-ldif --excludeAttribute "roomnumber" --backendID userRoot \
      --replaceExisting --ldifFile Example.ldif
  4. Start the server.
    $ start-ds
  5. Perform an ldapsearch to verify the import.

    The following example shows that the roomnumber attribute is now absent from Sam Carter's entry.

    $ ldapsearch --port 1389 --baseDN dc=example,dc=com --bindDN "cn=Directory Manager" \
      --bindPassword password "(cn=Sam Carter)"
    dn: uid=scarter,ou=People,dc=example,dc=com \
    objectClass: person
    objectClass: organizationalPerson
    objectClass: inetOrgPerson
    objectClass: top
    givenName: Sam
    uid: scarter
    cn: Sam Carter
    sn: Carter
    telephoneNumber: +1 408 555 4798
    ou: Accounting
    ou: People
    l: Sunnyvale
    mail: scarter@example.com
    facsimileTelephoneNumber: +1 408 555 9751

To Import a Compressed LDIF File

The import-ldif utility supports compressed LDIF files.

  1. Stop the server if it is running.
    $ stop-ds
  2. Import the compressed LDIF file.
    $ import-ldif --includeBranch dc=example,dc=com 
      --excludeBranch "ou=People,dc=example,dc=com" --ldifFile Example.ldif \
      --backendID userRoot --replaceExisting --isCompressed

To Record Rejected or Skipped Entries During Import

The import-ldif command provides a means to write to an output file for any entries that are rejected or skipped during the import process. This enables easy debugging of an LDIF file. Rejected entries occur when the directory server rejects the added entries due to schema violations. Skipped entries occur when entries cannot be placed under the specified base DN.

  1. Stop the server if it is running.
    $ stop-ds
  2. Import the file, using the --rejectFile and --skipFile options.

    You can also use the --overWrite option to replace any previous items in the two files. Without the option, the directory server appends new rejected and skipped entries to the existing files.

    $ import-ldif --backendID userRoot --append --ldifFile new.ldif 
      --overwrite --rejectFile rejected.ldif --skipFile skipped.ldif
  3. (Optional) View the contents of the rejectFile and skipFile to determine which entries were rejected or skipped during the import. For example:
    $ more rejected.ldif
    # Entry ou=Contractors,dc=example,dc=com read from LDIF starting at line 1 
    is not valid because it violates the server's schema configuration: 
    Entry ou=Contractors,dc=example,dc=com violates the Directory Server schema 
    configuration because it includes attribute changeType which is not allowed. 
    changetype: add objectclasses defined in that entry objectclass: top 
    objectclass: organizationalUnit ou: Contractors ou: Product Testing 
    ou: Product Dev ou: Accounting ...
    
    $ more skipped.ldif
    # Skipping entry ou=People,dc=example,dc=com because the DN is not one that should be 
      included based on the include and exclude branches objectclass: top 
      objectclass: organizationalunit ou: People 
      aci: (target ="ldap:///ou=People,dc=example,dc=com")(targetattr ="userpassword || 
      telephonenumber || facsimiletelephonenumber")(version 3.0;acl "Allow self entry 
      modification"; allow (write)(userdn = "ldap:///self");) 
      aci: (target ="ldap:///ou=People,dc=example,dc=com")(targetattr h3.="cn || sn || 
      uid") (targetfilter ="(ou=Accounting)")(version 3.0;acl "Accounting Managers Group 
      Permissions"; allow (write) 
      (groupdn = "ldap:///cn=Accounting Managers,ou=groups,dc=example,dc=com");) 
      aci: (target ="ldap:///ou=People,dc=example,dc=com")(targetattr h3.="cn || sn || 
      uid") (targetfilter ="(ou=Human Resources)")(version 3.0;acl "HR Group Permissions"; 
      allow write)(groupdn = "ldap:///cn=HR Managers,ou=groups,dc=example,dc=com");) aci: 
      (target ="ldap:///ou=People,dc=example,dc=com")(targetattr h3.="cn ||sn || uid") 
      (targetfilter ="(ou=Product Testing)")(version 3.0;acl "QA Group Permissions"; allow 
      (write)(groupdn = "ldap:///cn=QA Managers,ou=groups,dc=example,dc=com");) 
      aci: (target ="ldap:///ou=People,dc=example,dc=com")(targetattr h3.="cn || sn || 
      uid") (targetfilter ="(ou=Product Development)")(version 3.0;acl "Engineering Group 
      Permissions"; allow (write)(groupdn = 
      "ldap:///cn=PD Managers,ou=groups,dc=example,dc=com");) ...

To Import Data From a MakeLDIF Template

The directory server includes the Java utility, makeLDIF, that can be used to generate sample data for import. The makeLDIF utility requires a template file. You can create your own template file, or you can use the template file located in install-dir/config/MakeLDIF/example.template, editing it as required. For more information, see Creating MakeLDIF Template Files.

  1. Stop the server if it is running.
    $ stop-ds
  2. Import the data, using a template file.

    The sample template generates 10,003 sample entries in the specified back end.

    $ import-ldif --backendID userRoot --templateFile example.template --randomSeed 0
See Also

make-ldif in Sun OpenDS Standard Edition 2.0 Command-Line Usage Guide

To Run an Import in Online Mode

The import-ldif utility can also be run with the server online. In online mode, the command accesses the task back end over SSL via the administration connector. To run the command in online mode you must specify the relevant connection options, including how the SSL certificate will be trusted. This example uses the -X option to trust all certificates. For more information, see Managing Administration Traffic to the Server.

To Schedule an Import

The import-ldif utility provides a --start option for scheduling the import at some future date. You can view this scheduled task by using the manage-tasks utility. The command accesses the task back end over SSL via the administration connector. To schedule an import task, you must specify the relevant connection options, including how the SSL certificate will be trusted. This example uses the -X option to trust all certificates. For more information, see

See Also

Configuring Commands As Tasks