Tuesday 14 February 2017

Agent is out-of-sync with repository. This most likely means that the agent was reinstalled or recovered.


Check the status of the agent

$<AGENT_HOME>/bin>./emctl status  agent


---------------------------------------------------------------------------------------------------
Last successful upload                       : (none)
Last attempted upload                        : 2016-12-31 07:38:38
Total Megabytes of XML files uploaded so far : 0
Number of XML files pending upload           : 4
Size of XML files pending upload(MB)         : 0
Available disk space on upload filesystem    : 95.31%
Collection Status                            : Collections enabled
Heartbeat Status                             : Agent is blocked
Blocked Reason         : Agent is out-of-sync with repository. This most likely means that the agent was reinstalled or recovered. Please contact an EM administrator to unblock the agent by performing an agent resync from the console.
Last attempted heartbeat to OMS              : 2017-02-01 08:05:31
Last successful heartbeat to OMS             : (none)
Next scheduled heartbeat to OMS              : 2017-02-01 08:08:31

---------------------------------------------------------------
Agent is Running and Ready


1. Stop the agent in  target server.
<AGENT_HOME>/bin>./emctl stop agent

2. Ensure that there are no emagent processes on the target  server

$ps -ef|grep emagent

If you see any process, please kill all of them.
Kill -9 <PID>

3. Login to the repository database as SYSMAN user and execute the following query to clean up the old agent:

SQL>exec mgmt_admin.cleanup_agent('<hostname.domainname>:<port>');

4. After cleaning up the agent from repository,
   Please remove the files in target server (Don't delete  anything in Repository server)from the following locations:
  
    AGENT_HOME/sysman/emd/state/
    AGENT_HOME/sysman/emd/recv/
    AGENT_HOME/sysman/emd/upload/
    AGENT_HOME/sysman/log/

5. Start the agent:

<AGENT_HOME>/bin>./emctl start agent

6. Secure the Agent

<AGENT_HOME>/bin>./emctl secure agent
Please provide password