Search This Blog

Wednesday 14 August 2019

Automated Cache purging in OBIEE 12c

In this post We are going to create a shell script which will purge all the cache in OBIEE. This file could  be scheduled in a cronjob OR added in informatica or ODI to run everyday once all the loads are completed or Run manually whenever you would like to run.

Step1: Create purgecache.txt file like below

Purgecache.txt

call SAPurgeAllcache()

Step2: Create a shell script to call the above file and clear the purge.

****************************************************************************************

#purgeCache12c file is created for clearing BI 12c cache#

#File Name - purgecache.sh

#!/bin/bash

#OBIEE12c Home Location

export MW_HOME=/OBIEE12c

#Location of the Purgecache script file

export SCRIPT_PATH=/OBIEE12c/scripts/purgeCache

# Timestamp for Log file creation

TIME_STAMP=`date '+%Y%m%d_%H%M'`

#Log File directory and filename creation

export LOG_FILE=$SCRIPT_PATH/purgecache_${TIME_STAMP}.log

#Mail Group that you want to send (Optional)

MAIL_LIST="#bisupport@oracle.com"

#Command to clear BI Server Cache

$MW_HOME/user_projects/domains/bi/bitools/bin/nqcmd.sh -d AnalyticsWeb -u weblogic -p weblogicpwd -s $SCRIPT_PATH/purgecache.txt -o $LOG_FILE;

# Finding Purge cache Line Count for Cache Clear success or Fail

line_cnt=`cat $SCRIPT_PATH/purgecache.txt|wc -l`

SUCCESS_FLG=`grep -E 'Operation SAPurgeAllCache succeeded' $LOG_FILE|wc -l`;

if [ $SUCCESS_FLG = $line_cnt ]

then

        echo "Cache Cleared Successfully " >> $LOG_FILE

        echo `hostname` >> $LOG_FILE

        mailx -s "Cache Clearance Successful on `hostname`" $MAIL_LIST < $LOG_FILE

else

        echo "Cache clearance Failed" >> $LOG_FILE

        mailx -s "Cache Clearance Failed on `hostname`" $MAIL_LIST << EOT

        GCWUAT Cache clearance Failed, please verify

EOT

fi

#Command to Delete the log files which is older than 5 days

find $SCRIPT_PATH/ -name "*.log" -type f -mtime +2 -exec rm -rf {} \;

**************************************************************************************

Note:

MW_HOME environment variable value should be updated based on you BI 12c environment.

You can test this script file by running manually once in your environment by the below command.

./purgecache.sh


Happy Blogging!

Bose

2 comments:

OBIEE 12c to OAS Migration

 Hi All, I have migrated successfully few projects from BI 12c to OAS 6.4. If  anyone wants help then please reach Me! Cheers! Bose

Recent Posts