Remove everything being monitored by the old grid control
=========================================================

In OEM Grid control:
select ‘All TARGETS’
select ‘HOSTS’
Select the host.
Select ‘Targets’
Select ‘Select All’
Select ‘Remove’
Wait 1 minute.

On the host:
Stop the agent:
. oraenv
agent10g
emctl stop agent
Wait 1 minute.

On OEM:
Select ‘Select All’
Select ‘Remove’
Wait 1 minute.

Select ‘Hosts’
Select the radio button next to the host.
Select ‘Remove’

On the host:

Edit the Agent’s $ORACLE_HOME/sysman/config/emd.properties file
Change the REPOSITORY_URL to point to the new host.
e.g.
CHANGE:
REPOSITORY_URL=https://z1ns01orcp001.ar01.local:1159/em/upload
TO:
REPOSITORY_URL=https://z1ns02orcp001.ar01.local:4900/em/upload
AND
CHANGE:
emdWalletSrcUrl=http://z1ns01orcp001.ar01.local:4889/em/wallets/emd
emdWalletDest=/u01/app/oracle/product/10.2.0/agent10g/sysman/config/server
TO:
emdWalletSrcUrl=http://z1ns02orcp001.ar01.local:4889/em/wallets/emd
emdWalletDest=/u01/app/oracle/product/10.2.0/agent10g/sysman/config/server

Delete all the files in the following directories:
rm $ORACLE_HOME/sysman/emd/upload/*
rm $ORACLE_HOME/sysman/emd/state/*

Secure the agent:
emctl secure agent

emctl start agent

Register the host and databases in the ‘new’ grid control.

=======

Get the host name
get the agent home name
. oraenv
agent_home_name
cd $ORACLE_HOME/sysman/config
stop the agent
change host1 to host2
change port1 to port2
secure the agent
start the agent

 

OR

==

export ORAENV_ASK=NO
export ORACLE_SID=agent11g
. oraenv
emctl stop agent
find $ORACLE_HOME/sysman/config -name emd.properties | xargs perl -pi -e ‘s/OLD_NODE/NEW_NODE/g’
rm $ORACLE_HOME/sysman/emd/upload/*
rm $ORACLE_HOME/sysman/emd/state/*
emctl secure agent F1rec0n1
emctl start agent
emctl status agent