I was just wondering what everyone’s standard is for monitoring the size of their Recovery and Error Db files in $HCISITEDIR/exec/databases. I know that its good to reinitialize your databases periodically, but how do you determine when to do this?
Here is a script that I wrote which will echo the size (in MB) of the Recovery and Error Db for every site in the current $HCIROOT. It reads a list of sites to check from the file $HCIROOT/prodsites so that you can choose to exclude non-active sites and SiteProto.
#!/usr/bin/ksh
function showrecoverydbsizes {
echo “$1”
echo “n Recovery/Error Database sizesn  `date`n            `hostname`n”
echo “Site RecoveryDb ErrorDb” | awk ‘{ printf (”%-10s %10s %9sn”,$1,$2,$3) }’
echo “——– ———- ———” | awk ‘{ printf (”%-10s %10s %9sn”,$1,$2,$3) }’
for mysite in `cat $HCIROOT/prodsites`
do
  
  # echo and setsite to check
  #echo “Checking site: $mysite”
  setsite $mysite
  
  # Verify the setsite command was successful
  sitecheck=`showroot | grep “HCI site” | awk ‘{print $4}’`
  if [[ $sitecheck != $mysite ]]
  then
  	 echo “nSetsite Command was unsuccessfull. Aborting Script.n”
     return
  fi
  rdbsize1=`ls -al $HCISITEDIR/exec/databases/rlogMid.dat | awk ‘{ print $5 }’`
  rdbsize2=`ls -al $HCISITEDIR/exec/databases/rlogM2k.dat | awk ‘{ print $5 }’`
  
  edbsize1=`ls -al $HCISITEDIR/exec/databases/elogMid.dat | awk ‘{ print $5 }’`
  edbsize2=`ls -al $HCISITEDIR/exec/databases/elogM2k.dat | awk ‘{ print $5 }’`
  
  rdbsize=$((($rdbsize1+$rdbsize2)/2000000))
  edbsize=$((($edbsize1+$edbsize2)/2000000))
  
  echo “$mysite $rdbsize  $edbsize” | awk ‘{ printf (”%-10s %7d MB %6d MBn”,$1,$2,$3) }’
done
echo “nDone.n”
}
# execute main function
showrecoverydbsizes
unset showrecoverydbsizes mysite sitecheck rdbsize1 rdbsize2 edbsize1 edbsize2 rdbsize edbsize
Sample output:
hsprim1b>ShowDbSizes.sh
 Recovery/Error Database sizes
  Thu Oct 29 11:41:17 CDT 2009
            hsprim1b
Site       RecoveryDb   ErrorDb
——–   ———- ———
tds              0 MB      0 MB
lab              6 MB      1 MB
shec             9 MB      0 MB
seb             23 MB      0 MB
sns              5 MB      0 MB
sms              2 MB      1 MB
sjcf             3 MB      0 MB
sjb              1 MB      0 MB
smgb             6 MB      0 MB
svgb             0 MB      0 MB
sjh              1 MB      0 MB
msae            29 MB      1 MB
mctyaie         17 MB      0 MB
mctydcfh        60 MB     16 MB
mctykbg         18 MB      0 MB
mctymjl         21 MB      0 MB
msmd            42 MB      1 MB
pem             41 MB      0 MB
msjsf1           3 MB      0 MB
msjsf2           8 MB      0 MB
msjst1          53 MB      0 MB
msjst2          59 MB      0 MB
msfl            11 MB      0 MB
Done.