How to add custom attribute, Object Classe in OID from command line or GUI

I discussed about Attribute and Object Class in Oracle Internet Directory (OID) in my previous post here  . OID comes with default attributes and objects classes and provides mechanism (Graphical User Interface – GUI and Command Line Interface – CLI) to add attributes and objects classes (Process of adding attributes and object classes is also known as OID Schema Extension)

In this post I am going to show how to add attributes and object class both from CLI and GUI.

First some theory :

1. ODSM more here,  is a Graphical Tool to create/view/manage Attributes/Object Classes (Select tab Schema & then select Attributes or Object Classes)

2. OID schema is stored under cn=subschemasubentry at Root DSE (Directory Server Entry) 

3. To read schema definition (list of defined attributes, object classes) run
 ldapsearch -h [host] -p [port] -b “cn=subschemasubentry” -s base “objectclass=*”  (where host is OID server and Port is OID port)

4. Use ldapmodify (LDAP command) to define new attribute/object class

.

.

How to add attribute from GUI ?

1. Login to ODSM http://server:port/odsm(where server is hostname of machine where ODSM/WebLogic wls_ods1 managed server is running and port is wls_ods1 managed server port i.e. 7005)

2. Select tab Schema

3. Click on Attributes or Object Classes

4. Click on Add button

.

.

How to add attribute from CLI ?

1.Create a ldif file with list of all attributes and object classes like

_________________________

dn: cn=subschemasubentry
changetype: modify
add: attributetypes
attributetypes: ( 99.99.99.99.01 NAME ‘attribute1’ DESC ‘Custom Attribute 1’ EQUALITY caseIgnoreMatch SYNTAX ‘1.3.3.4.1.1466.115.121.1.15’ )

dn: cn=subschemasubentry
changetype: modify
add: attributetypes
attributetypes: ( 99.99.99.99.02 NAME ‘attribute2’ DESC ‘Custom Attribute 2’ EQUALITY caseIgnoreMatch SYNTAX ‘1.3.3.4.1.1466.115.121.1.15’ )

dn: cn=subschemasubentry
changetype: modify
add: objectClasses
objectClassess: ( 99.99.99.99.03 NAME ‘class1’ DESC ‘custom object class 1’ SUP top STRUCTURAL MUST cn MAY ( Attribute1 $ Attribute2 ) )

dn: cn=subschemasubentry
changetype: modify
add: objectClasses
objectClassess: ( 99.99.99.99.04 NAME ‘class2’ DESC ‘custom object class 2’ SUP top AUXILIARY MAY ( Attribute1 $ Attribute2 ) )

_________________

Lets understand what is in above LDIF file

a) I am creating two attributes and two object classes using LDIF file above .

B)  Each attribute/object class is separated by blank line (You will hit error if you don’t leave blank line between two attributes/object classes)

c) Number 99.99.99.99.0X represents Object Identifier which is unique number

d) attribute1/2, class1/2 represents name of attribute or object class

e)  EQUALITY caseIgnoreMatch represents that attribute is case insensitive

f) SYNTAX ‘1.3.3.4.1.1466.115.121.1.15’  represents that attribute is of type Directory String . Other option for SYNTAX are Binary, Boolean, Certificate, Audio…

g) SUP top in object class represents that Super class for particular Object class is top (top is object class of OID)

h) STRUCTURAL (objectclass1), AUXILIARY (objectclass2) represents object class type (In total Object Class are of three type STRUCTURAL, AUXILIARY and ABSTRACT )

i) MUST represents mandatory attributes and MAY represents optional attributes.

j) Multiple attributes are added by putting then between ( ) and $ as seperator

2. Next step after creating LDIF file is to load this file in OID using

$ORACLE_HOME/bin/ldapadd -h [OID_Host] -p [OID_Port] -D “cn=orcladmin” -w [orcladmin_password] -f [name_of_LDIF_file]  (Where ORACLE_HOME is set to OID ORACLE_HOME

3. Above step will create attribute and object class in OID , next step is to add indexes to attributes loaded above (Attribute with Indexes are search-able)

$ORACLE_HOME/ldap/bin/catalog connect=oiddb add=TRUE attribute=[name_of_attribute] verbose=TRUE  (Where ORACLE_HOME is set to OID ORACLE_HOME. Make sure ORACLE_INSTANCE is set to OID instance

.

References

About the Author Masroof Ahmad

Leave a Comment:

9 comments
Kiran says October 3, 2012

Hello Atul,

Can we create a custom attribute for storing the temporary password in OID 11g?

Reply
    Atul Kumar says October 7, 2012

    Why do you want to do that ? You can extend OID schema to define custom attribute and treat that as temporary password attribute. You should define this attribute as secure

    Reply
nraju says August 23, 2013

Is there a way to update an existing custom object class? We have a custom object class that has a couple of custom attributes as a “must”. We want to add another custom attribute to the list.

Reply
    Atul Kumar says August 24, 2013

    @nraju,
    Did you try changing existing custom Object Class from ODSM ?

    Reply
saikr0 says January 10, 2014

i am using OID 11g and i’m trying to add “preferred country” attribute. but its not adding properly.

for your reference please check the below snapshot.

adding new entry cn=REIMADMIN,cn=Users,dc=xxxx,dc=com
ldap_add: Object class violation
ldap_add: additional info: Failed to find preferredcountry in mandatory or optional attribute list.

Reply
    Atul Kumar says January 17, 2014

    Is this attribute “preferred country” added to any objectclass ?

    And this objectclass should be attached to users

    Or you can add attribute to objectclass that is already attached to Users

    Reply
Extending the OID 11g schema via ldapmodify says April 3, 2014

[…] tip to OnlineAppsDBA for his work. I stood on his shoulders for this […]

Reply
Shama Nagabhushana says August 12, 2016

Hi Atul,

I tried the catalog command to create index to an attribute on the OID server(both ORACLE_HOME and ORACLE_INSTANCE set). But Im receiving Could not connect to databse due to SSL port being in place in tnsnames.ora. Is there any way to connect to OID DB in a secure way?

Reply
Prashant chaudhary says November 14, 2018

Hi Atul,

What i have follow to create custom attribute mentioned below :-
1. create custom attribute in schema tab
2. create a new object class and adding that newly created custom attribute in newly created object class.
3. adding that object class in cn=Users under data browser.

the problem is the attribute is only visible under OID Users attributes i.e cn=Users, dc=uppcl,dc=org
form not for seperate Users attribute like cn=ANKIT CHAUDHARY,cn=Users,dc=uppcl,dc=org

Reply
Add Your Reply