Tuesday 3 July 2012

EM12C agent redeploy

Okay, so now you have BP1 to install and the upgrade instructions look heinous… What are you going to do?  Truck on with the upgrade – or reinstall with BP1.  I’ve decided to do the reinstall.

Basically, created my new OEL VM on OVM.

Installed 11GR2 DB

Installed EM12C BP1 on new machine, mentioning database above

now, it’s time for the agents and the new JD Edwards management software, notifications and software updates (NOT FUN!!!)

I developed a script that you might be able to use, but I suggest testing it carefully.

  1. In general to locates the oracle inventory and cycles through the 12c components and uninstalls them
  2. It kills the 12c agent processes
  3. If called with CLEAN as the only parameter will remove the entire base directory for the 12C agent installation.

#!/usr/bin/ksh
#kill the management procs
kill -9 `ps -ef |grep 12c| grep -v grep| awk '{print $2}'`

#call runInstaller to remove the components
# get a list of the components from oraInventory
ORACLE_INVENTORY=`cat /etc/oraInst.loc | awk -F\= '/inventory_loc/{print $2}'`
echo $ORACLE_INVENTORY
#list EM12C components
SOFTWARELIST=`cat $ORACLE_INVENTORY/ContentsXML/inventory.xml |grep REFHOME |grep 12c | awk -F\" '{printf("%s,",$2)} END {} '`
echo $SOFTWARELIST
#append the actual home to the list
AGENTHOME=`cat $ORACLE_INVENTORY/ContentsXML/inventory.xml | awk -F\" '/agent12c/ {print $4}'`
echo $AGENTHOME
BASEDIR=`echo $AGENTHOME | awk -F/ 'BEGIN {} { for (i=2;i<NF-1;i++) printf("/%s",$i) } END {}'`
echo $BASEDIR

#We now have the reference homes and the Agent home, so delete them
if [ -x "$AGENTHOME/oui/bin/runInstaller" ]
  then
    #we can delete
    $AGENTHOME/oui/bin/runInstaller -silent "REMOVE_HOMES={$SOFTWARELIST}" -deinstall -waitForCompletion -local
    $AGENTHOME/oui/bin/runInstaller -silent "REMOVE_HOMES={$AGENTHOME}" -deinstall -waitForCompletion -local
else
  echo "cannot execute $AGENTHOME/oui/bin/runInstaller"
fi

if [ -d $BASEDIR ]
then
  if [ "$1" == "CLEAN" ]
    then
      rm -Rf $BASEDIR
  else
      echo "NOT CALLED WITH CLEAN OPTION, therefore no force remove"
  fi
else
  echo "$BASEDIR not exists or not writable"
fi

exit 0

You can do everything this script does manually, but that might take you a while.

An interesting test would be to create this script as a “procedure” in your original console and deploy and run it.  This would have the affect of (hopefully) deleting all components and then allowing you to deploy this to all of your hosts!

Once the script has executed, you may then install your new agents via your BP1 console.

1 comment:

petercmoore said...

Hi Shannon. I needed to do an OEM 12c agent re-install and this script came in very handy. Thanks!