Cloning Oracle Management Agent OEM 11g

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/

Optionally change file agentDownload.aix:

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
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

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

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 ..
zip -ry $CLONE/agent11g_home_11. agent11g -x@$CLONE/ExcludeList.txt 

Copy archived home (zip or tar.gz) to OMS host, e.g.
You can see the files in Web browser

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

Using SSH (method 1):
ssh oracle@omshost 'cat /oracle/middleware/oms11g/sysman/agent_download/' | gunzip | tar xvf –

Using WGET (method 2):
wget -q -O- http://omshost:4889/agent_download/ | 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

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/
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.