Monday, December 17, 2012

How to migrate users/groups from one OID instance to the other

Requirement: Migrate users/groups from source OID to target OID instance.
How To:
Source:
  • Export ORACLE_HOME env variable of OID instance.
  • Run ldapsearch command for exporting users as shown below.
$ORACLE_HOME/bin/ldapsearch -x -h OID_HOST -p OID_PORT -D cn=orcladmin -w password -L -b "USERS_DN" -s one "objectclass=*" dn cn givenname ....... sn telephonenumber userpassword > oid_filteruser.txt
  •  Run ldapsearch command for exporting groups as shown below.
$ORACLE_HOME/bin/ldapsearch -x -h oidserver.corp.company.com -p 389 -D cn=orcladmin -w password -L -b "GROUPS_DN" -s one "objectclass=*" > oid_filtergroup.txt

NOTE: For exporting users, specify the attributes to be exported either mandatory/optional.

Copy the files  oid_filteruser.txt and oid_filtergroup.txt to the target OID instance at location say /oracle/db/oid_files.

Destination:
  •  Export ORACLE_HOME env variable of OID instance.
  • Stop OID server.
  • Goto $ORACLE_HOME/ldap/bin 
  • Run ldapsearch command for importing users as shown below. 
 ./bulkload connect="OID_SCHEMA_NAME" generate=true load=true file="/oracle/db/oid_files/oid_filteruser.txt"
  • To get the OID_SCHEMA_NAME, refer the tnsnames.ora file of OID environment. 
  • It will prompt for OID schema password.
  • Run ldapsearch command for importing groups as shown below.
./bulkload connect="OID_SCHEMA_NAME" generate=true load=true file="/oracle/db/oid_files/oid_filtergroup.txt"
  •  It will prompt for OID schema password.
  • Start OID server.
  • Login to OID console to see the changes.