Wednesday, July 6, 2011

Oracle Enterprise Manager 11g: Install & configure EM CLI in agents for failovers in Cold Failover Cluster

First of all, install agents in all cluster nodes, discover  and configure the targets running in them.
If a node fails and you move your oracle service to a working node, you would want to inform OMS for this relocation.
This is accomplished, using Enterprise Manager Command Line Interface (EM CLI).

Download emclikit.jar from your grid installation:

http(s)://[host]:[port]/em/console/emcli/download

The following must be executed for every agent deployed in cluster nodes.

Set your JAVA_HOME enviroment (Java 1.6.0 or greater is needed):
export JAVA_HOME=[java directory]
export PATH=$JAVA_HOME/bin:$PATH

Under agent's home create a "emcli" directory and put emclikit.jar in it.
Run:
java -jar emclikit.jar client -install_dir=[directory where emclikit.jar is placed]

Setup EM CLI:
emcli setup -url="http(s)://[host]:[port]/em" -username=sysman -password=[sysman password] -licans=YES -dir=[directory where emclikit.jar is placed] -trustall -localdirans=YES

You can check targets discovered by your OMS, running the following query:
SELECT * FROM SYSMAN.MGMT_TARGETS ORDER BY TARGET_TYPE;

Or by giving the following command:
emctl config agent listtargets

Now, lets say you relocate a target e.g. a database called TESTDB from node1 to node2.
If node1's agent is still running, you can leave everything as it is. An agent can monitor targets running in other nodes.
If node1 completely fails and its agent stops running, you should instruct OMS to monitor this target using another agent, so execute:
emcli relocate_targets -src_agent=node1:[agent's port, default 3872] -dest_agent=node2:[agent's port, default 3872] -target_name=TESTDB -target_type=oracle_database -copy_from_src -force=YES

If you get a "target [database instance, oracle_database] is broken: cannot compute dynamic properties in time" error:
emctl stop agent

Edit [agent's home]/sysman/config/emd.properties and change value of dynamicPropsComputeTimeout to 120.

emctl start agent
emctl upload agent

No comments:

Post a Comment