2011-12-22

Cloning Oracle Management Agent OEM 11g

Environment
AIX 5.3.0.0
Oracle Enterprise Manager (OEM) Grid Control 11.1

Agent Installation
Create oracle user, groups and prepare .profile in UNIX.
Install agent by any method, e.g. agentDownload script.

Download file agentDownload.aix from OMS to target host.
wget http://omshost:4889/agent_download/11.1.0.1.0/aix/agentDownload.aix

Optionally change file agentDownload.aix:
doDiscovery=FALSE
startAgent=FALSE

Install agent:
./agentDownload.aix -b /oracle/oem -r 4889
Port number 4889 is necessary otherwise it will try to use HTTPS and port 1159, which didn’t work in my case.

Run root.sh script

Patch oracle agent
1. install latest OPatch (6880880)
2. apply proper TZ patch (6672979 for Australia)
3. apply recommended patches (PSU and others)

If you are going to use agent on this host then configure agent
agentca –f
Otherwise we don’t need to configure or start agent.

Prepare master archive file
It can be ZIP or TAR.GZ (or something similar)

Advantage of ZIP: it can be used as source file by Grid Control Cloning Wizard (in GC click Deployments > Install Agent > Clone Agent)
Disadvantage of ZIP: unzip cannot read from pipe or standard input, so zip file is copied to target host and then unzipped by Wizard or manual method. It takes bit extra space (1GB) and time.
Advantage of tar.gz: it can be uncompressed directly from SSH or WGET, see examples below
Disadvantage of tar.gz: it cannot be used by Grid Control Cloning Wizard

Prepare exclude list
# CLONE is any temp location
export CLONE=/oracle/software/clones
cd $ORACLE_HOME
find . -name "*.log" >$CLONE/ExcludeList.txt
find . -name "*.err" >>$CLONE/ExcludeList.txt
vi $CLONE/ExcludeList.txt
Add the following to the exclude list. It is taken from OMS host $OH/sysman/prov/agentpush/resources/scripts/exclude.lst
./sysman/upload/*
./sysman/emd/state/*
./sysman/emd/*
./sysman/log/*
./sysman/j2ee/*
./ccr/hosts/*
./ccr/state/*
./sysman/emd/*/*
./sysman/emd/*/*/*
./sysman/emd/*/*/*/*
./ccr/hosts/*/*
./ccr/hosts/*/*/*
./ccr/hosts/*/*/*/*
./bin/nmo
./bin/nmhs
./bin/nmb

Create tar.gz archive
cd $ORACLE_HOME
tar -X $CLONE/ExcludeList.txt -cvf - . | gzip -c >$CLONE/agent11g_home_11.1.0.1.5.tar.gz

Create zip archive
Attention: when you create the ZIP file, create it from the parent directory of the Oracle home (that’s GC wizard requirement)
cd $ORACLE_HOME
cd ..
zip -ry $CLONE/agent11g_home_11.1.0.1.5.zip agent11g -x@$CLONE/ExcludeList.txt 

Copy archived home (zip or tar.gz) to OMS host, e.g.
$ORACLE_HOME/sysman/agent_download/11.1.0.1.0/clones
You can see the files in Web browser
http://omshost:4889/agent_download/11.1.0.1.0/clones/

Deploying agent from tar.gz
Create oracle user on target host
Prepare .profile

Using SSH (method 1):
cd $ORACLE_HOME
ssh oracle@omshost 'cat /oracle/middleware/oms11g/sysman/agent_download/11.1.0.1.0/clones/agent11g_home_11.1.0.1.5.tar.gz' | gunzip | tar xvf –

Using WGET (method 2):
cd $ORACLE_HOME
wget -q -O- http://omshost:4889/agent_download/11.1.0.1.0/clones/agent11g_home_11.1.0.1.5.tar.gz | gunzip | tar xvf -

Run Installer:
cd $ORACLE_HOME/oui/bin
./runInstaller -clone -forceClone ORACLE_HOME=/oracle/oem/agent11g ORACLE_HOME_NAME=OH_agent11g -noconfig -silent OMS_HOST=omshost OMS_PORT=4889

As root
/oracle/oem/agent11g/root.sh

Continue as oracle user
Configure the Management Agent by running the following script:
$ORACLE_HOME/bin/agentca –f

Deploying agent from zip manually
You cannot pipe into unzip. So you have to download zip file to target and then unzip.
wget http://omshost:4889/agent_download/11.1.0.1.0/clones/agent11g_home_11.1.0.1.5.zip
Then run Installer and etc. as in example above.

Deploying agent from zip by Grid Control Wizard
Attention: in this method Oracle Home Name is assigned automatically; it looks something like AGT3561027

In Grid Control click Deployments > Install Agent > Clone Agent
Well, the rest is trivial.