cn=changelog on Oracle Internet Directory

How do I query for the last change in the changelog for an Oracle Internet Directory?

This came up today when we needed to advance the orcllastappliedchangenumber in a DIP (Directory Integration Platform, a/k/a odisrv) configuration for an export connector beyond the last change on the directory. You typically do this when you want to prevent queued up changes from being passed when you restart the connector.

While you could use oidadmin to do this (changelog entries appear under the “Change Log Management” node), the command line can sometimes be quicker.

There are two places you can query for the last change, either at the root DSE or under “cn=changelog”.

Here is the syntax to query the DSE root, using Oracle’s version of ldapsearch for a “change”:

ldapsearch -L -h -D "cn=orcladmin" -w **** -b "" -s base "objectclass=*" lastchangenumber

The attribute lastchangenumber is a system attribute, and so needs to be explicitly requested.

Here is how to query “cn=changelog”, this time using the OpenLDAP version of ldapsearch:

ldapsearch -x -LLL -h -D "cn=orcladmin" -w **** -b "cn=changelog" -s one "objectclass=*"

The last entry shown in the output will be the last applied change.

Note that for this search the subtree level is set at “one”. This is the only way to do this kind of search. Using “sub” will fail the search.

The nice thing about this latter method is that you get to see what the change was, which can often be useful information to have.

Also note that data in the “changes” attribute will come out as MIME-encoded text, because it contains formatting and other special characters. You can decode this by running the LDIF through a script and pushing the text out to a file or use an LDAP editor like Apache Directory Studio to export the “cn=changelog” node as a .csv or .xls file. You’ll find formatting the resulting output a bit tricky. If you convert into an Excel worksheet, try these values:

Column width:

dn=35, changenumber=13, operationtime=16, targetdn=36, changes=70

Cell formatting:

Type=text, Horizontal=Left, Verticle=Top, Wrap=checked