---
title: Extending the schema using a custom schema file
description: To add new attributes and object classes to your PingDirectory server schema, create a custom schema file.
component: pingdirectory
version: 11.0
page_id: pingdirectory:pingdirectory_server_administration_guide:pd_ds_extend_scheme_custom_file
canonical_url: https://docs.pingidentity.com/pingdirectory/11.0/pingdirectory_server_administration_guide/pd_ds_extend_scheme_custom_file.html
revdate: May 10, 2024
section_ids:
  steps: Steps
  example: Example:
  example-2: Example:
  choose-from: Choose from:
  example-3: Example:
  example-4: Example:
  result: Result:
---

# Extending the schema using a custom schema file

To add new attributes and object classes to your PingDirectory server schema, create a custom schema file.

## Steps

1. Create an LDIF file with the new attribute extensions using a text editor.

   ### Example:

   ```
   dn: cn=schema
   objectClass: top
   objectClass: ldapSubentry
   objectClass: subschema
   attributeTypes: ( contractorStatus-OID NAME 'contractorStatus'
     EQUALITY booleanMatch
     SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
     SINGLE-VALUE
     USAGE userApplications
     X-ORIGIN 'Directory Server Example' )
   attributeTypes: ( contractorAgency-OID NAME 'contractorAgency'
     EQUALITY caseIgnoreMatch
     SUBSTR caseIgnoreSubstringsMatch
     SYNTAX 1.3.6.1.4.1.1466.115.121.1.44{256}
     SINGLE-VALUE
     USAGE userApplications
     X-ORIGIN 'PingDirectory Server Example' )
   ```

2. In the LDIF file you created in step 1, add a new object class definition after the attribute types.

   ### Example:

   This example creates an auxiliary object class, `contractor`, that alone cannot be used as an entry.

   The object class is used to add supplemental information to the `inetOrgPerson` structural object class. The attributes are all optional for the new object class.

   ```
   objectClasses: ( contractor-OID
     NAME 'contractor'
     DESC 'Contractor status information'
     SUP top
     AUXILIARY
     MAY ( contractorStatus $ contractorAgency )
     X-ORIGIN 'PingDirectory Server Example' )
   ```

3. Save the file and place it in the `<server-root>/config/schema` directory.

   In this example, the file is saved as `99-auxobjclass.ldif`.

4. Load the schema extensions into the PingDirectory server. You have four options:

   ### Choose from:

   * Create a task that loads the new extensions into the schema.

     The following example creates a task with the ID `add-schema-99-auxobjclass` and adds it using `ldapmodify`.

     ```
     dn: ds-task-id=add-schema-99-auxobjclass,cn=Scheduled Tasks,cn=tasks
     objectClass: top
     objectClass: ds-task
     objectClass: ds-task-add-schema-file
     ds-task-id: add-schema-99-auxobjclass
     ds-task-class-name: com.unboundid.directory.server.tasks.AddSchemaFileTask
     ds-task-schema-file-name: 99-auxobjclass.ldif
     ```

     |   |                                                               |
     | - | ------------------------------------------------------------- |
     |   | When using this method, you don't need to restart the server. |

   * Import the schema file using the admin console schema editor.

     |   |                                                               |
     | - | ------------------------------------------------------------- |
     |   | When using this method, you don't need to restart the server. |

     1. Place the `99-auxobjclass.ldif` file in the `<server-root>/config/schema` directory.

     2. Restart PingDirectory server.

        |   |                                     |
        | - | ----------------------------------- |
        |   | The schema file is read at startup. |

   * Add the schema file using `load-ldap-schema-file`.

     ```shell
     $ bin/load-ldap-schema-file --schemaFile config/schema 99-auxobjclass.ldif
     ```

     |   |                                                               |
     | - | ------------------------------------------------------------- |
     |   | When using this method, you don't need to restart the server. |

5. Add the new object class and attribute to an existing user entry.

   ### Example:

   ```shell
   $ bin/ldapmodify
   dn: uid=user.9,ou=People,dc=example,dc=com
   changetype: modify
   add: objectClass
   objectClass: contractor
   -
   add: contractorStatus
   contractorStatus: TRUE
   ```

6. To verify the addition, run `ldapsearch` to display the attribute.

   ### Example:

   ```shell
   $ bin/ldapsearch --baseDN dc=example,dc=com "(uid=user.9)" contractorStatus
   ```

   ### Result:

   ```
   dn: uid=user.9,ou=People,dc=example,dc=com
   contractorStatus: TRUE
   ```
