Copying the schema to other servers

 

Use this information to copy a schema to other servers. To copy a schema to other servers, do the following:

  1. Use the ldapsearch utility to copy the schema into a file:
    ldapsearch -b cn=schema -L "(objectclass=*)" > schema.ldif

  2. The schema file will include all objectclasses and attributes Edit the LDIF file to include only the schema elements you want, or, you might be able to filter the ldapsearch output using a tool like grep. Be sure to put attributes before the objectclasses that reference them. For example, you might end up with the following file (note that each continued line has a single space at the end, and the continuation line has at least one space at the beginning of the line).
    attributetypes: ( myattr1-oid NAME 'myattr1' DESC 'Some piece of   information.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 EQUALITY 2.5.13.2
      USAGE userApplications )
    IBMAttributetypes: ( myattr1-oid DBNAME( 'myattr1'  'myattr1' )
      ACCESS-CLASS normal LENGTH 500 )
    attributetypes: ( myattr2-oid NAME 'myattr2' DESC 'Some piece of   information.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 EQUALITY 2.5.13.2
      USAGE userApplications )
    IBMAttributetypes: ( myattr2-oid DBNAME( 'myattr2'  'myattr2' )
      ACCESS-CLASS normal LENGTH 500 )
    objectclasses: ( myobject-oid NAME 'myobject' DESC 'Represents   something.' SUP 'top' STRUCTURAL MUST ( cn ) MAY ( myattr1 $ myattr2 ) )

  3. Insert lines before each objectclasses or attributetype line to construct LDIF directives to add these values to the entry cn=schema. Each object class and attribute must be added as an individual modification.
    dn: cn=schema changetype: modify add: attributetypes ibmattributetypes attributetypes: ( myattr1-oid NAME 'myattr1' DESC 'Some piece of   information.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 EQUALITY 2.5.13.2
      USAGE userApplications )
    IBMAttributetypes: ( myattr1-oid DBNAME( 'myattr1'  'myattr1' )
      ACCESS-CLASS normal LENGTH 500 )
    
    dn: cn=schema changetype: modify add: attributetypes ibmattributetypes attributetypes: ( myattr2-oid NAME 'myattr2' DESC 'Some piece of   information.' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 EQUALITY 2.5.13.2
      USAGE userApplications )
    IBMAttributetypes: ( myattr2-oid DBNAME( 'myattr2'  'myattr2' )
      ACCESS-CLASS normal LENGTH 500 )
    
    dn: cn=schema changetype: modify add: objectclasses objectclasses: ( myobject-oid NAME 'myobject' DESC 'Represents   something.' SUP 'top' STRUCTURAL MUST ( cn ) MAY ( myattr1 $ myattr2 ) )

  4. Load that schema on other servers using the ldapmodify utility:
    ldapmodify -D cn=administrator -w <password> -f schema.ldif

 

Parent topic:

Schema tasks