Logo Background

Bulk Delete (bulkdelete.sh) Users From Oracle Internet Directory (OID)

  • By on June 3, 2009 | No Comments

    Sometimes we need to perform bulk delete using bulkdelete.sh on Oracle Internet Directory (OID) when we encountered error when doing bulk load migration of Oracle E-Business Suite to OID using bulkload.sh, and when the bulkload -recover option does not remove the users loaded to OID.

    $ bulkload.sh -connect <connect string> -recover

    One main concern on the bulkdelete.sh command is generally used to clean all users and group entries on directory tree level which means it will totally wipe off any entries like orcladmin and PUBLIC.

    First, we need to avoid few users such as orcladmin, Public, Portal and other administrator account from being deleted.

    So instead of using bulk delete (bulkdelete.sh) command, we will use other deletion technique with the help of ldapsearch and ldapdelete commands.

    Using ldapsearch and ldapdelete commands to remove OID users

    1. First, you need to know what is the directory tree of users that you want to perform the deletion on (s_UserContainerDN), source of subscriber DN.

    2. Get all the user entries first using ldapsearch command and spool it to a file

    $ ldapsearch -h <oid_hostname> -p <oid_ldap_port> -D "cn=orcladmin" -w <password> -s \
    one -b "cn=Users,<source subscriber DN>" "(objectclass=orcluserv2)" "cn=*" > users.ldif

    Example:

    $ ldapsearch -h <oid_hostname> -p <oid_ldap_port> -D "cn=orcladmin" -w <password> -s \
    one -b "cn=Users,dc=spain,dc=oracle,dc=com" "(objectclass=orcluserv2)" "cn=*" \
    > users.ldif

    3. Edit the spool output ldif file, users.ldif to remove entires which you want to preserve such as orcladmin, Portal and public. You may want to preserve the following seeded users:

    cn=orcladmin,cn=Users,<source subscriber DN>
    cn=ias_admin,cn=Users,<source subscriber DN>
    cn=PUBLIC,cn=Users,<source subscriber DN>
    cn=Portal<*>,cn=Users,<source subscriber DN>
    cn=sample<*>,cn=Users,<source subscriber DN>
    cn=synd<*>,cn=Users,<source subscriber DN>
    cn=uddi<*>,cn=Users,<source subscriber DN>

    (Note:Example above include users/entries that could be seeded by certain midtier installs, so they may or may not exist in a particular OID)

    4. Use the ldapdelete command along with the edited output ldif file to delete all the users:

    $ ldapdelete -h <oid_hostname> -p <oid_ldap_port> -D "cn=orcladmin" \
    -w <password> -c -v -f users.ldif
     
    deleting entry cn=UNCLE_SAM,cn=Users,dc=spain,dc=oracle,dc=com
    entry removed
    deleting entry cn=LARRY_ELISSON,cn=users,dc=spain,dc=oracle,dc=com
    entry removed
    Previous
    Next
    » Oracle Workflow Notification Mailer
Leave a Comment