Thursday, September 24, 2015

Delete all users from OID without deleting default users like orcladmin, Public and Portal

The bulkdelete command is generally used to delete all users and group entries.

However, there may be situation where there is a need to delete most of the users but keep only the default users such as orcladmin, Public and Portal or any other users with Administrator account.

This can be achieved using ldapsearch and ldapdelete commands.

Step 1) Login to OID server.

Step 2) Export all environment variables.

export ORACLE_INSTANCE=$MW_HOME/asinst_1
export ORACLE_HOME=$MW_HOME/Oracle_IDM
export ORACLE_SID=OIDDB
 
Step 3) First, you need to know what is the directory tree of users that you want to perform the deletion on source of subscriber DN(Distinguish Name).

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

SYNTAX:

ldapsearch -h <OID host> -p <OID port> -D "cn=orcladmin" -w <OID superuser password> -s one -b "cn=users,<source subscriber DN>" "(objectclass=orcluserv2)" "cn=*" > user.txt

EXAMPLE:

$cd $ORACLE_HOME/bin
$./ldapsearch -h ****.oracle.com -p 3060 -D "cn=orcladmin" -w welcome2 -s one -b "cn=users,dc=au,dc=oracle,dc=com" "(objectclass=orcluserv2)" "cn=*" > user.txt

Step 4) Open user.txt file in any text editor software and remove entries for orcladmin, Public and Portal or any other users with Administrator account.
Save user.txt.

Step 5) Use the ldapdelete command along with the edited user.txt file to delete all the users:

SYNTAX: 

ldapdelete -h <host> -p <port> -D "cn=orcladmin" -w <superuser password> -c -v -f user.txt

EXAMPLE:

$cd $ORACLE_HOME/bin
$./ldapdelete -h ****.oracle.com -p 3060 -D "cn=orcladmin" -w welcome2 -c -v -f user.txt

Step 6) Users are now deleted.


Ref  : Doc ID 335671.1


 




No comments:

Post a Comment

Other Posts