<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi team.<div class=""><br class=""></div><div class="">Below is a useful tool that I have been working on for a bit. This is a universal CODB database index checker tool. The code is not pretty, but it is effective. There are two basic parts to the script. The first bit checks the class indexes. After the recent memcache issues, there were a number of systems that had corrupt class indexes. This part of the script will test and validate your class indexes, and report any problems. The last part of the script is a modified version of an older script with a few tweaks to check the codb.oids list of used OID numbers. </div><div class=""><br class=""></div><div class="">Paste all of the content below into a file called indexcheck.sh on your server. The script should be owned by root and have execute permissions. For each of the checks it performs, you will have a simple pass or fail result. When you first execute the script, it will be a little slow on the first line of output - after that, it will fly along.</div><div class=""><br class=""></div><div class="">Enjoy.</div><div class=""><br class=""></div><div class="">Greg Kuhnert</div><div class=""><br class=""></div><div class="">============</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">#!/bin/bash</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">#</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""># First check the class indexes</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">#</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">CCE=/usr/sausalito/bin/cceclient</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">for CLASS in `echo classes | $CCE  | grep ^110 | cut -d " " -f 3-`</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">do</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        echo -n Checking $CLASS</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        echo find $CLASS | $CCE | grep ^104 | cut -d " " -f 3- | sort -n > /tmp/$CLASS.index</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        grep "^$CLASS$" /usr/sausalito/codb/objects/*/.CLASS | cut -d "/" -f 6 | sort -n > /tmp/$CLASS.oid</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        diff /tmp/$CLASS.index /tmp/$CLASS.oid > /tmp/$CLASS.diff</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        if [ $? -eq 0 ]; then</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                rm /tmp/$CLASS.index /tmp/$CLASS.oid /tmp/$CLASS.diff</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                echo " - Pass"</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        else</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                echo " - ***Fail***"</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        fi</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">done</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">#</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""># Now check the codb.oids index</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">#</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">LAST=-1</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">MIN=-1</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">MYOID=/tmp/myoid</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">rm $MYOID</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">for X in `ls /usr/sausalito/codb/objects/ | sort -n`</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">do</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        MYNEXT=$(( $LAST + 1 ))</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        if [ $MYNEXT -eq $X ]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        then</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                LAST=$X</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        else</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                if [ $LAST -ge 1 ]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                then</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                        if [ $MIN -eq $LAST ]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                        then</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                                echo -n $LAST, >> $MYOID</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                        else</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                                echo -n $MIN-$LAST, >> $MYOID</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                        fi</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                fi</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                LAST=$X</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">                MIN=$X</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        fi</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">done</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">if [ $MYNEXT -lt $X ]</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">then</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        echo -n $LAST >> $MYOID</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">else</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">        echo -n $MIN-$LAST >> $MYOID</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">fi</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">diff -q $MYOID /usr/sausalito/codb/codb.oids</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">echo -n Checking codb.oids</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">if [ $? -eq 0 ]; then</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  echo " - Pass"</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">else</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">  echo " - ***Fail***"</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">fi</div></div><div class=""><br class=""></div></body></html>