Wednesday, March 19, 2014

Purging corrupted OBIEE web catalog users

Sometimes it can happen that user profiles within a web catalog become corrupted for any number of reasons. In order for these user profiles to be correctly re-initialized, there's more to be done than just drop /users/JohnDoe from the web catalog.

All in all there are three distinct places which need to be cleaned:
  • /users/JohnDoe
  • /system/users/123456
  • /system/acocuntids/987654
This is really important since especially the third place contains the translation between the userid and the effective GUID of the user. I've written a little script which takes the absolute path to the web catalog in question as well as the user to be purged and kills everything that's necessary.

NOTE: This is a quick&dirty solution and I haven't fool-proofed it with any check like "does the folder exist" etc. so use it cautiously and on your own risk.

I may get around to rendering it safer later-on, but since I was asked for it once more just today I thought I'd put it out there.


#!/bin/bash
#
# Purpose: Completely purge a named user from the web catalog with all his content.
#
# Requires absolute path to webcat as param 1 and user name as param 2
#
#
# Author: Christian Berg
# Initial creation: 28/01/2014
# Absolutely no warranty, use at your own risk
# Please include this header in any copy or reuse of the script you make
#
# Current version: 1.0
#
# Change log:
#        CBERG 28/01/2014 Intial creation
#


########################################################################################
# Step 1: Kill the users personal folder plus content with its accompagning .atr       #
########################################################################################

cd $1/root/users

find -type d -name $2 | xargs rm -rf
find -name $2.atr | xargs rm -f

########################################################################################
# Step 2: Kill the users entries in /system/users                                      #
# Two files will be affected "username" and "username.atr"                             #
# Removal happens one-by-one                                                           #
########################################################################################

cd $1/root/system/security/users

find -name $2 | xargs rm -f
find -name $2.atr | xargs rm -f

########################################################################################
# Step 3: Kill the users entries in /system/accountids                                 #
# Two files will be affected. Accountids contains the translation from GUID to         #
# username, so the actual username resides within the files content rather than its    #
# name. Bulk removal.                                                                  #
########################################################################################

cd $1/root/system/security/accountids

grep -r -l $2 . | xargs rm -f

echo User $2 has been purged from the web catalog.

exit 0

No comments:

Post a Comment