Define the attribute you want to add to the custom schema file.

The following example procedure adds a predefined attribute, contractorAddress, to the custom schema file, then adds it to the contractor object class.

  1. Create and save an LDIF file with the content in the following example.

    In this example, the file is named contractorAddress-attr.ldif.

    dn: cn=schema 
    changetype: modify 
    
    add: attributeTypes attributeTypes: ( contractor-OID NAME 'contractorAddress' 
      SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 
      SINGLE-VALUE 
      USAGE userApplications 
      X-ORIGIN 'user defined' 
      X-SCHEMA-FILE ’98-custom-schema.ldif’ ) 
      X-ORIGINS ’user defined’ 
      X-SCHEMA-FILE ’98-custom-schema.ldif’ )
  2. To add the attribute you defined, run ldapmodify.

    In this example, the contractorAddress attribute is being added.

    $ bin/ldapmodify --filename contractorAddress-attr.ldif
  3. To modify the contractor object class to allow this attribute, create an LDIF file.

    When doing this, you are re-adding the updated objectClass. The Directory Server handles the proper replacement of the existing object class with the new one.

    Note:

    Ensure that the lines are not wrapped, the objectClasses line should be one continuous line.

    In this example, the file is named contractor-oc.ldif.

    dn:cn=schema 
    changetype: modify 
    add: objectClasses 
    objectClasses: ( contractor-OID NAME ’contractor’ 
      DESC ’Contractor status information 
      SUP top 
      AUXILIARY MAY ( contractorStatus $ contractorAgency $ contractorAddress ) 
      X-ORIGIN ’Directory Server Example’ 
      X-SCHEMA-FILE ’98-custom-schema.ldif’ )
  4. To update the objectClass, run ldapmodify.
    $ bin/ldapmodify --filename contractor-oc.ldif
    These schema changes are replicated to all servers in the replication topology.
  5. To verify the change, view the config/schema/98-custom-schema.ldif file on the other servers in the replication topology to ensure that the changes are present.
  6. Optional: To add an index for this attribute, run dsconfig with the create-local-db-index option.
    Note:

    You must do this on each server in your topology unless you have server configuration groups set up.

    For more information, see Configuring Server Groups.

    $ bin/dsconfig create-local-db-index --backend-name userRoot \ 
      --index-name contractorAddress --set index-type:equality
  7. Rebuild the index online.
    Note:

    This doesn't affect other indexes or entries because there is no existing data for this attribute on any entry.

    $ bin/rebuild-index --baseDN dc=example,dc=com --index contractorAddress