Using LDIFWRITE and BULKLOAD – Oracle Collabsuite 10g

Hi All,

I am having a collabsuite instance in test and production and I was checking the way to take backup of users in OID. I came across the utility LDIFWRITE and BULKLOAD.SH. Using these script we can take a backup of users in OID and restore back the same.

Here is how we use.

Using LDIFWRITE

ldifwrite is a ldap utility present in INFRA ORACLE_HOME/bin directory.

-bash-3.00$ ldifwrite
usage: ldifwrite [-c <Connect String>] -b <Base DN> -f <filename>
[-e <encoding>] [-t <no. of threads>]
-c = Connect String
-b = BaseDN
-f = LDIF filename
-e = Encoding scheme
-t = Number of threads to be created
-bash-3.00$ ldifwrite -c ocsdev -b “cn=Users, dc=ap6019fems, dc=us, dc=oracle, dc=com” -f ocsdev.ldif
This tool can only be executed if you know database user password for OiD
Enter OiD Password ::

————————————————————
Reading entries under BaseDN “cn=users,dc=ap6019fems,dc=us,dc=oracle,dc=com”…
————————————————————-

————————————————————
17 Entries are written to “ocsdev.ldif”.
————————————————————

Here ocsdev is the name of metadata repository I am using and BaseDN is where all your users entries are stored or created. We can take backup of any BaseDN into ldif file. Above command will generate an ldif file called ocsdev.ldif.

Using BULKLOAD

bulkload.sh script is present on INFRA tier in ORALCE_HOME/ldap/bin directory. Using bulkload.sh for loading user entries from ldif file to OID involves 3 steps

1) check schema for any duplicate or bad entries using -check option

[ocs10g@ap6059rt bin]$ bulkload.sh -connect orcl -check /slot03/oracle/product/ocs10g_1/infra/ocsdev.ldif

Verifying node “orcl”
—————————–
This tool can only be executed if you know database user password
for OiD on orcl
Enter OiD password ::

————————————————————-
Checking data for bulk loading for valid structure…
————————————————————-

No Schema Check Errors.

No Bad Entries found.

No Duplicate DN Entries.

————————————————————-
Bulkload data verification complete
————————————————————-
2) Generate an intermediate file for loading using -generate option.

While running with this option you have to have your OID process down, else you have to run the same command in -append mode.

If OID process is not down you might get following error.

[ocs10g@ap6059rt bin]$ bulkload.sh -connect orcl -check -generate /slot03/oracle/product/ocs10g_1/infra/ocsdev.ldif

Verifying node “orcl”
—————————–
This tool can only be executed if you know database user password
for OiD on orcl
Enter OiD password ::
OID Processes running on target node “orcl”
Shutdown OID Process on “orcl” for bulkload

After shutting down OID we can run the command as given below.

[ocs10g@ap6059rt bin]$ bulkload.sh -connect orcl -check -generate /slot03/oracle/product/ocs10g_1/infra/ocsdev.ldif

Verifying node “orcl”
—————————–
This tool can only be executed if you know database user password
for OiD on orcl
Enter OiD password ::

——————————————————————
Checking Internet Directory current schema state
——————————————————————

——————————————————————-
Checking and Generating Internet Directory data for bulk loading
——————————————————————-

Schema Check Errors are logged in : /slot03/oracle/product/ocs10g_1/infra/ldap/log/bulkload.log

Bad Entries are logged in : /slot03/oracle/product/ocs10g_1/infra/ldap/load/badentry.ldif

No Duplicate DN Entries.

——————————————————————-
Data Generated for bulk loading
——————————————————————-

3) Loading the data from intermediate file to OID using -load option.

[ocs10g@ap6059rt bin]$ bulkload.sh -connect orcl -load /slot03/oracle/product/ocs10g_1/infra/ocsdev.ldif

Verifying node “orcl”
—————————–
This tool can only be executed if you know database user password
for OiD on orcl
Enter OiD password ::
It is recommended to use -check option before generating/loading data
Do you want to continue (y/n?) [n]
y
Loading data on : “orcl”
===============================

——————————————————————
Preparing Internet Directory schema for bulk data loading
——————————————————————

——————————————————————
Initiating bulk load…
——————————————————————

Loading Attribute Search Catalogs..
battr_store001..
battr_store002..
battr_store003..
.

.

Log file for the same will get generated in $ORACLE_HOME/ldap/log/bulkload.log location.

While loading if there are any duplicate entries then it will be present in $ORACLE_HOME/ldap/log/duplicateDN.log file.

All bad entries will be present in $ORACLE_HOME/ldap/load/badentry.ldif

References:

Oracle OID Admin Guide

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s