Using Net::LDAP perl Module

Hi All, this post is related to using Net::LDAP perl module to register, search and delete the users in OID (oracle internet directory). I have been struggling to get this perl code for me. Finally I was able to create a perl script for doing the same.

Initially I tried the same thing using ldapadd command (for adding users in OID). But this has some dependencies. Like for using ldapadd command you need AS10g Oracle home installed where you can reference to these commands. Even if AS10g home is not present you can still use the perl binaries for LDAP. But this again depends on our perl installation. Not all perl installation is having these binaries installed.

So best approach is to use Net::LDAP module for the same. Remember there is a URI::LDAP module also. But this cannot be used, we need Net::LDAP module. You can check if this module is present in your perl installation or not Possibly this should be present as a file in one of the location present in @INC). If the module is not present then you can install the same by following the below simple steps.

You can download the Net::LDAP perl module from CPAN

Instruction for install 

Unzip the module and run the following steps

  • perl Makefile.PL
  • make
  • make test
  • su root
  • make install

Once you install the module you can connect to LDAP server and add the user. Below is the perl script I have used for the same.

Perl script for using Net::LDAP 

#!/local/bin/perl -I /oracle/iAS/perl_modules/lib/perl5/site_perl/5.8.0
#use strict;
#use warnings;
use Net::LDAP;

$ldap = Net::LDAP->new("") or die "$@";
$mesg = $ldap->bind("cn=orcladmin", password=>"welcome1");

%mon = ("Jan","01","Feb","02","Mar","03","Apr","04","May","05","Jun","06","Jul","07","Aug","08","Sep","09","Oct","10","Nov","11","Dec","12");

my $gen_time= localtime();
my @TimeStamp = split(/ /, $gen_time);
my $TimeStamp=$TimeStamp[4].$mon{$TimeStamp[1]}.$TimeStamp[2]."000000z";

$arg = "$ARGV[$0]";


$mesg = $ldap->search(filter=>"(uid=$uid)", base=>"dc=ap6059rt,dc=us,dc=oracle,dc=com");
$mesg->count && $ldap->delete($dn);

$result = $ldap->add($dn, 
                attr => [ 'uid' => $uid,
                          'cn' => $cn,
                          'sn' => $sn,
                          'mail' => $mail,
                          'givenName' => $givenName,
                          'userpassword' => $userpassword,  
                          'orcltimezone' =>  $orcltimezone,      
                          'orclactivestartdate' => $TimeStamp,     
                          'orclisenabled' => $orclisenabled,            
                          'objectclass' => [ 'person', 'inetOrgPerson', 'organizationalperson', 'orcluser', 'orcluserv2', 'ctCalUser', 'orclUserProvStatus']
$result->code && warn "error: ", $result->error;


You need to just pass the username which you want to register in OID and this script will register the same.

/oracle/iAS/perl_modules/lib/perl5/site_perl/5.8.0 is the location where my Net::LDAP module is installed and I am including the same in my script as first line using -I option.

Hope this helps !!


Creating users in OID (Oracle Internet Directory) – Oracle Collabsuite 10g


his port is regarding creation of users in central OID (Oracle Internet Directory) instance. We call it a central because of its architecture. Usually for any business setup, there will be many instances of application and a single installation of OCS or Oracle AS. Either of these techstack is having OID as one of the component. So the users of all the instances are basically registered in this central OID instance.

So here we will see, how to create users in OID. We can create users either through UI or through command line API. We will see both the methods here.

Creating users using UI:

Navigate to the OID self service console, the URL will be in the form as given below.


1) Click on the right hand top corner to login


2) use the super user ID having all privileges to create a user. In my case its orcladmin


3) Once you login, click on directory tab and then click on create button


4) First screen will ask for general information. Here you need to enter password for user.


5) You can provision the various component for this user. Example in case of mail, if its provisioned, then by default a mail account will be created for user.


6) On third screen, you can check the information and also keep the default information as it is. You can also decide the quota for mail server.


7) Review screen. You can review and finish

If you search for the user you created you should be able to see the record.


Creating users using command line

You can use the following command for creating users from command line.

These commands needs to be run on the host where the OID is installed. Also make sure to source the environment before creating the user.



Creating a user:

1. Create an ldif file called orcl.ldif that includes the following content:

      dn: cn=orcladmin, User_Search_Base
changetype: add
uid: orcladmin
mail: orcladmin
givenName: orcladmin
cn: orcladmin
sn: orclAdmin
description: Seed administrative user for subscriber.
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetorgperson
objectClass: orcluser
objectClass: orcluserV2



2. Execute the following command (the following command is one continuous line):

ldapadd -h OID_host -p non-SSL_port -D OID_superuser -w OID_superuser_password -v -f orcl.ldif


ldapadd -p 389 -h ap6059rt -D “cn=orcladmin” -w “welcome1” -v -f test.ldif

sh-2.05b$ ldapadd -p 389 -h ap6059rt -D “cn=orcladmin” -w “welcome1” -v -f test.ldif
do modify ****
add objectclass:
add givenname:
add sn:
add orcltimezone:
add mail:
add uid:
add orclactivestartdate:
add cn:
add orclisenabled:
adding new entry cn=avdeo,cn=users,dc=us,dc=oracle,dc=com
modify complete

Searching for the user:

ldapsearch uid=avdeo

sh-2.05b$ ldapsearch uid=avdeo

Deleting users from LDAP:

ldapdelete -p non-SSL_port -h OID_host -D OID_superuser -w OID_superuser_password username


ldapdelete -p 389 -h ap6059rt -D cn=orcladmin -w welcome1 “cn=avdeo,cn=users,dc=us,dc=oracle,dc=com”


Metalink Note ID: 125301.1

Oracle OID Admin Guide

Open LDAP Manual page

Installing OCS (Oracle Collabsuite) 10g – Linux

Introduction:This document gives a step by step approach for installing OCS (Oracle Collabsuite) 10g. This is created from the Oracle documentation available on OTN. This serves as a simple guide for installation of OCS 10g.

Setup Details:

OS Detail :

bash-2.05b$ uname -a
Linux ap6059rt 2.4.21- #1 SMP Fri Feb 24 18:01:54 PST 2006 i686 i686 i386 GNU/Linux
bash-2.05b$ cat /etc/issue
Red Hat Enterprise Linux AS release 3 (Taroon Update 6)
Kernel \r on an \m
OCS 10g Version : Oracle Collabsuite 10g Release I (

Pre – Installation Steps

Download the required OCS software zip files to one of the directory on slot and unzip the same in a separate directory.

bash-2.05b$ ls -rlttotal 12
drwxrwxrwx 2 oracle oracle 4096 Mar 5 16:08 OCS-Supp-DVD
drwxr-xr-x 2 oracle oracle 4096 Mar 5 16:08 OCS-Main-DVDs

Perform the following pre-reqs steps before starting the installation. These are the pre-installation steps.

1) Check the free space on slot and also under /tmp directory

[oracle@ap6059rt /slot03]$ df -k .
Filesystem 1K-blocks Used Available Use% Mounted on
140509184 4416256 136092928 4% /SLOTS/slot03
[oracle@ap6059rt /slot03]$ df -k /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 46354176 183516 43815936 1% /tmp
[oracle@ap6059rt /slot03]$

2) Check the swap memory available. It should be atleast twice that of RAM memory.

[oracle@ap6059rt /slot03]$ grep SwapTotal /proc/meminfoSwapTotal: 24587472 kB
visual id: 0x32
class: TrueColor
depth: 16 planes
available colormap entries: 64 per subfield
red, green, blue masks: 0xf800, 0x7e0, 0x1f
significant bits in color specification: 6 bits

3) Check the Linux Red Hat release and important packages

Note:- Login as root and then perform these tasks.

[jmyang@ap6059rt /slot03]# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 3 (Taroon Update 6)

[jmyang@ap6059rt /slot03]# rpm -q glibc-2.3.2

[jmyang@ap6059rt /slot03]# rpm -q glibc-common-2.3.2

[jmyang@ap6059rt /slot03]# rpm -q binutils-

[jmyang@ap6059rt /slot03]# rpm -q compat-db-4.0.14

[jmyang@ap6059rt /slot03]# rpm -q compat-glibc-7.x

[jmyang@ap6059rt /slot03]# rpm -q compat-libstdc++-7.3

[jmyang@ap6059rt /slot03]# rpm -q compat-libstdc++-devel

[jmyang@ap6059rt /slot03]# rpm -q gcc-3.2.3

[jmyang@ap6059rt /slot03]# rpm -q gcc-c++-3.2.3

[jmyang@ap6059rt /slot03]# rpm -q libstdc++-3.2.3

[jmyang@ap6059rt /slot03]# rpm -q libstdc++-devel-3.2.3

[jmyang@ap6059rt /slot03]# rpm -q openmotif21-2.1.30

[jmyang@ap6059rt /slot03]# rpm -q pdksh-5.2.14

[jmyang@ap6059rt /slot03]# rpm -q setarch-1.3

[jmyang@ap6059rt /slot03]# rpm -q make-3.79.1

[jmyang@ap6059rt /slot03]# rpm -q gnome-libs-

[jmyang@ap6059rt /slot03]# rpm -q sysstat-5.0.5
sysstat-5.0.5-5.rhel3 4) Checking Kernel parameters.

4) Checking Kernel parameters

Note:- All these values should be updated as a root user. So login as root and then perform these tasks.


shmall is -sh-2.05b# cat /proc/sys/kernel/shmall
it is smaller than 3279547
so we need to modify the /etc/sysctl.conf

Once this file is modified we can run /sbin/sysctl -p for this to take effect.
You can check all the kernel parameters using

sh-2.05b# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
kernel.sysrq = 1
kernel.core_uses_pid = 1
fs.file-max = 1677721
vm.pagecache = 1 15 15
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.shmall = 3279547
net.ipv4.tcp_tw_recycle = 1
kernel.sem = 1100 32000 100 1100
kernel.msgmnb = 65535
kernel.msgmni = 2878
kernel.msgmax = 8192
net.ipv4.ip_local_port_range = 10000 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
kernel.sysrq-key = 64

5) To improve the performance of the software on Linux system, you must increase the following shell limits for oracle user

– login as root

– Add the following lines to /etc/security/limits.conf file:

  • soft nproc 4096
  • hard nproc 16384
  • soft nofile 16384
  • hard nofile 65536

– Add the following lines to the /etc/pam.d/login file, if it does not already exist:

session required /lib/security/

– Add the following lines to the /etc/pam.d/su file, if you use su to switch to oracle account

6) Check your shell and add the below content accordingly

sh-2.05b# echo $SHELL

  • For the C or tch shell, add the following lines to the /etc/csh.login file:

if ( $USER == “oracle” ) then
limit maxproc 16384
limit descriptors 65536

  • For the Bourne, Bash, or Korn shell, add the following lines to the /etc/profile file:

if [ $USER = “oracle” ]; then
if [ $SHELL = “/bin/ksh” ]; then
ulimit -p 16384
ulimit -n 65536
ulimit -u 16384 -n 65536

7) Location of the Default Identity Management Realm has been set in /etc/hosts
The hosts file should use the following format:

ip_address fully_qualified_hostname short_hostname

Example: primaryHost

sh-2.05b$ cat /etc/hosts localhost.localdomain localhost ap6059rt

This completes all pre-reqs steps. Now starting with installation.

Installation Steps

Unzip the downloaded DVD in one of the directories before starting the installation.

For Example in my case the location for ZIP was

sh-2.05b$ pwd/slot03/ocs10g/downloads/OCS-Main-DVDs
sh-2.05b$ ls -lrt
total 3725448
-rw-r–r– 1 oracle oracle 1840273814 Mar 5 14:10
-rw-r–r– 1 oracle oracle 1967099379 Mar 5 14:42

Created a directory call setup at /slot03/ocs10g/downloads location and unziped both the zip files in setup directory.

sh-2.05b$ cd /slot03/ocs10g/downloads/setup/
sh-2.05b$ unzip /slot03/ocs10g/downloads/OCS-Main-DVDs/

sh-2.05b$ unzip /slot03/ocs10g/downloads/OCS-Main-DVDs/

Your setup directory will now look like this

sh-2.05b$ cd /slot03/ocs10g/downloads/setup/
sh-2.05b$ ls -lrt
total 36
-rwxrwxrwx 1 oracle oracle 4715 Oct 26 2005 runInstaller
-rw-r–r– 1 oracle oracle 4410 Oct 27 2005 welcome.html
drwxrwxrwx 2 oracle oracle 4096 Nov 2 2005 response
drwxrwxrwx 5 oracle oracle 4096 Nov 2 2005 install
drwxrwxrwx 8 oracle oracle 4096 Nov 2 2005 doc
drwxrwxrwx 4 oracle oracle 4096 Nov 2 2005 calendar_standalone
drwxrwxrwx 8 oracle oracle 4096 Mar 5 22:06 stage

Another important thing before starting the installation is to rename a file /etc/tnsname.ora. If this file is present then installation will give error and will be terminated. So make sure to login as root user and rename this file to some other name

sh-2.05b$ mv /etc/tnsname.ora /etc/tnsname.ora.backup

Start the installation by running runInstaller present in unzipped directory (/slot03/ocs10g/downloads/setup/ in my case).

Make sure that the installation is started as oracle user and not as root.

sh-2.05b$ cd /slot03/ocs10g/downloads/setup

sh-2.05b$ ./runInstaller -invPtrLoc /slot03/oracle/product/ocs10g/oraInst.loc

Screen 0) A welcome screen will come. Click on next and go to next screen


Screen 1) Specify Inventory directory and Credential Specify the inventory directory and the group which will be th owner of inventory. In our case we want the user oracle to be the owner of inventory and its primary group is DBA. So we are providing the group for inventory as DBA


Screen 2) Specify File Location
Specify the ORACLE_HOME location where the software will be installed. Under this location 1 or 2 directories will be created (depending on your installation). Once will be for infra and other for application.


Screen 3) Select a product to install
select the product you want to install. We are here doing the complete installation. So we will be installing infra as well as application. Depending on your requirement you can choose either or both of them.


Screen 4) Installer will carryout the pre-reqs checking and will flag an error if any of the pre-reqs are not satisfied.


Screen 5) Language Selection
Select the language you want to install


Screen 6) This screen will summarize the selection done till now. Validate and click on next to go to next screen.


Screen 7) Select component to configure
You can select one or more component you want the installer to configure for you. In our case we are going for all the components.


Screen 8) Specify Namespace in Internet Directory
The distinguished name (DN) that you specify in the Specify Namespace in Internet Directory screen will be designated as the namespace in Oracle Internet Directory, where users and groups are administered.

A suggested namespace appears on the screen. The installer determines the suggested namespace from the /etc/hosts file. If it meets your deployment requirements, then select it. If not, enter another DN in the Custom Namespace field.


Screen 9) Specify database configuration option
Enter a name for the Oracle Collaboration Suite Database. You can give any name (less than 8 chars) for database or even accept the default one.


Screen 10) Specify database schema password
Its good to have common password for all account. This is to avoid confusion.


Screen 11) Specify Application Passwords
Its good to have same passwords as database user passwords. This is to avoid confusion.


Screen 12) Specify Oracle Mail Domain Information


Screen 13 – a) Specify port Configuration Options
In this screen specify the port you want your application to use. You can go with default port numbers of you can specify your own port numbers. When specifying custom ports, make sure that the port is not in use. You can check if the port is in use or not using netstat -an | grep <port no> command. Also if specifying the custom ports, then make sure that port numbers are above 1024. In our case, we changed the HTTP port number from 80 to 7779. Also SSl port has been changed from 443 to 4443. The ranges for the port is given in 3rd column.
Also note that these ports are for infra installation. When installing application, it will again ask for the ports.


Screen 13 – b) Also the port number of SMTP server was already in use. So you can change the port number from 25 to some unused port (example 30).


Screen 14) Warning
This screen will show a warning, since some of the ports are below 1024. Only root user is having access to ports below 1024. You can select the check box “I authorize SUID root actions” and click on next.


Screen 15) Installation summary.
Click on “Install” button to begin installation of infra.


Screen 16) Shows the installation progress for infra tier. Remember that in our installation, we have selected to install infra as well as application. So first it will install infra and then application. Installing infra also involves installing database also. This is shown in screen 17 below.
After this installation progress screen, when the installation comes to end, installer will ask to run as root user.
When such message appears, start another session and login as root. Run the required script and then come to this screen, click on OK. Do not click on OK before running

During our installation, we faced some issue while running We logged a bug 6870418 for the same and as per server team, the underlying filer was not having root privileges. After this bug is resolved, we were able to run 181.jpg

Screen 17) Shows all the components of infra getting installed in the back screen. Database installation is in progress and is shown in front screen.


Screen 18) Shows the component progress during installation. After this screen infra installation completes and installer automatically starts application (mid tier) installation.


Screen 19) Specify port configuration options
Installer will ask for ports for the second time. These ports are for applicaiton (mid tier). Example there will be 2 HTTP server process that will run, one for infra and one for mid tier. So we have to specify HTTP port for both. Similar is the case with other ports as well. If you remember we have given 7779 initially for HTTP port of infra. We can change that here to 7778 or some thing else. Even if we keep the ports same as that of infra (example 7779), it will automatically select different ports. In our case we have kept the same port number as that of infra. (that is 7779 for HTTP, 4443 for SSL and 30 for SMTP. All other ports are having default values).After clicking next, it will show the installation progress for each component similar to screen Screen 18) and after the installation of all components of mid tier, installer will ask to run again. After running the installation will end.

================================================================= Use the following URL to access the Oracle Collaboration Suite Console :

Use the following URL to access the Oracle Collaboration Suite
Release Notes:

Global Database Name:

Post Installation steps

For accessing database from UNIX prompt, you need to source the environment using the following export commands.

This will source the required ORACLE_HOME (infra) and other parameters mentioned below.

export ORACLE_HOME=/slot03/oracle/product/ocs10g/infra
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_SID=ocs10g
  • OID account can be unlocked as given below
sh-2.05b$ oidpasswd connect=ocs10g unlock_su_acct=true
OID DB user password:
OID super user account unlocked successfully.
  • Performing Component-Specific Tasks

sh-2.05b# export ORACLE_HOME=/slot03/oracle/product/ocs10g/infra
sh-2.05b# export PATH=$ORACLE_HOME/bin:$PATH
sh-2.05b# tnslsnr listener_es -user 8000 -group 8000 &

  • Configuring the Time-out Value in the sqlnet.ora File

Set following parameter in sqlnet.ora
SQLNET.EXPIRE_TIME = 10 References:

Installing Apache 2.2.4 in UNIX

You can carry out a basic standalone installation of Apache 2.2.4 on UNIX using the below mentioned steps. Required steps are written and can be understood easily.

The below steps are taken from official Apache Org site.

Step 1) Getting the Apache 2.2.4 dumps

You can get the software dump for Apache from official site. You can download the required dump from this page.

Step 2) Once you get the dump, it will be in the form of zip file (.gz). You can unzip the file dump using following command

gunzip httpd-2.2.4.tar.gz

After this you will get a .tar file. You need to extract this and get all the required files. You can do the same using following command

tar -xvf httpd-2.2.4.tar

Step 3) Once you extract all the files, next you need to configure the source tree.This is done using the script configure included in the root directory of the dump.

To configure the source tree using all the default options, simply type ./configure. To change the default options, configure accepts a variety of variables and command line options.

The most important option is the location –prefix where the Apache HTTP Server is to be installed later, because Apache HTTPd has to be configured for this location to work correctly. More fine-tuned control of the location of files is possible with additional configure options.

Use the below step to configure Apache source tree. To run the below command you have to be in the dump directory of apache.

./configure –prefix=/u01/app/oracle/product/apache –enable-rewrite=shared –enable-speling=shared

Step 4) Build

Now you can build the various parts which form the Apache HTTPd package by simply running the command:

Below command also needs to be run from dump directory.

[oracle@ocvmrh2023 httpd-2.2.4]$ make

Step 5) Now it’s time to install the package under the configured installation directory by running:

[oracle@ocvmrh2023 httpd-2.2.4]$ make install

Step 6) configure Apache.

We can do the simple configuration by just setting the correct port number. By default it will have port 80. You need to set some other port, which is unused. For my installation I am setting the port 7771. The port number is to be set in httpd.conf file in [APAHCE_HOME dir]/conf directory.

Once you do that bounce the apache using following command. The below script is present in [APACHE_HOME dir]/bin

[oracle@ocvmrh2023 bin]$ ./apachectl stop
httpd (no pid file) not running
[oracle@ocvmrh2023 bin]$ ./apachectl start
[oracle@ocvmrh2023 bin]$

You can confirm the installation by accessing the server using the below URL

http://(hostname : port)/

In my case it will be

You can see a text “It works!“. This confirms that your apache installation went fine.