This post is also available at:
Português

Error when trying to start the Enterprise Manager agent:
Target Manager failed at Startup: targets.xml was rejected: loaded with a wrong agent token.
This error occurred in Enterprise Manager Cloud Control version 12c.
[emc12@host ~]$ emctl start agent
Oracle Enterprise Manager Cloud Control 12c Release 5
Copyright (c) 1996, 2015 Oracle Corporation. All rights reserved.
Starting agent .................... failed.
Target Manager failed at Startup: targets.xml was rejected: loaded with a wrong agent
token
Consult emctl.log and emagent.nohup in: /u01/app/emc12/emagent/agent_inst/sysman/log
BashPart of the file /u01/app/emc12/emagent/agent_inst/sysman/log/emctl.log
----
UID PID PPID C STIME TTY TIME CMD
emc12 29059 28496 0 14:47 pts/0 00:00:00 /bin/sh -f /u01/app/emc12/emagent/core/12.1.0.5.0/bin/emctl start agent -f
----
29068 :: Tue Aug 1 14:47:41 2017::Calling acquireGlobalLock (1)
29068 :: Tue Aug 1 14:47:41 2017::AgentCommandLock:Acquiring a lock(type=1)on emctl lockfile
29068 :: Tue Aug 1 14:47:41 2017::AgentCommandLock:lockFile returns 1
29068 :: Tue Aug 1 14:47:41 2017::acquireGlobalLock returned: 1
29068 :: Tue Aug 1 14:47:41 2017::EM_SECURE_HOSTNME: 10.221.63.20
29068 :: Tue Aug 1 14:47:41 2017::EM_SECURE_PORT: 3872
29068 :: Tue Aug 1 14:47:41 2017::EM_LISTEN_ON_ALL_NICS: true
29068 :: Tue Aug 1 14:47:43 2017::AgentLifeCycle.pm:status agent returned with retCode=1
29135 :: Tue Aug 1 14:47:43 2017::AgentLifeCycle.pm: Launching the watchdog process.
29135 :: Tue Aug 1 14:47:43 2017::TZ = America/Sao_Paulo, Read = America/Sao_Paulo. Found = 1.
29135 :: Tue Aug 1 14:47:44 2017::validateTZAgainstAgent: America/Sao_Paulo, America/Sao_Paulo
29135 :: Tue Aug 1 14:47:44 2017::agentTZRegion successfully validated.
29135 :: Tue Aug 1 14:47:44 2017::AgentTuning.pm: Launching emdctl with -Xmx1024m
29135 :: Tue Aug 1 14:47:45 2017::AgentStatus.pm:emdctl run_autotune returned 0
29068 :: Tue Aug 1 14:47:43 2017::AgentLifeCycle.pm: Launched the watchdog process pid=29135
29068 :: Tue Aug 1 14:47:43 2017::AgentLifeCycle.pm: StartCEMD start retryCount=120
29068 :: Tue Aug 1 14:47:54 2017::AgentLifeCycle.pm: StartCEMD status message file detected
29068 :: Tue Aug 1 14:47:54 2017::Found Msg file with: {1501609674348,exiting}
29068 :: Tue Aug 1 14:47:55 2017::AgentLifeCycle.pm: StartCEMD status message file detected
29068 :: Tue Aug 1 14:47:55 2017::Found Msg file with: {1501609674348,exiting}
29068 :: Tue Aug 1 14:47:56 2017::AgentLifeCycle.pm: StartCEMD status message file detected
29068 :: Tue Aug 1 14:47:56 2017::Found Msg file with: {1501609674348,exiting}
29068 :: Tue Aug 1 14:47:57 2017::AgentLifeCycle.pm: StartCEMD status message file detected
29068 :: Tue Aug 1 14:47:57 2017::Found Msg file with: {1501609674348,exiting}
29068 :: Tue Aug 1 14:47:58 2017::AgentLifeCycle.pm: StartCEMD status message file detected
29068 :: Tue Aug 1 14:47:58 2017::Found Msg file with: {1501609674348,exiting}
29068 :: Tue Aug 1 14:47:59 2017::AgentLifeCycle.pm: StartCEMD status message file detected
29068 :: Tue Aug 1 14:47:59 2017::Found Msg file with: {1501609674348,exiting}
29068 :: Tue Aug 1 14:48:00 2017::AgentLifeCycle.pm: StartCEMD status message file detected
29068 :: Tue Aug 1 14:48:00 2017::Found Msg file with: {1501609674348,exiting}
29068 :: Tue Aug 1 14:48:00 2017::AgentLifeCycle.pm:Watch dog processs id: 29135 exited with an exit code of 55
29068 :: Tue Aug 1 14:48:00 2017::AgentLifeCycle.pm: Exited loop retryCount=103 with retCode=1
29068 :: Tue Aug 1 14:48:00 2017::AgentLifeCycle.pm: StartCEMD Querying for the real status of the agent
29068 :: Tue Aug 1 14:48:02 2017::AgentLifeCycle.pm: StartCEMD live status of the agent is 1 after 0 retries.
29068 :: Tue Aug 1 14:48:02 2017::AgentLifeCycle.pm: Check agent status retCode=1
29068 :: Tue Aug 1 14:48:02 2017::TZ: EmctlLogAvailabilityMarker Operation=start Diag=failed
29068 :: Tue Aug 1 14:48:02 2017::Calling releaselobalLock
29068 :: Tue Aug 1 14:48:02 2017::AgentCommandLock:released lock on emctl lockfile
29068 :: Tue Aug 1 14:48:02 2017::Released agent command lock
29068 :: Tue Aug 1 14:48:02 2017::Cleaning up agent command lock
29068 :: Tue Aug 1 14:48:02 2017::AgentCommandLock:closed file handle of emctl lockfile
BashSolution
The solution to this error is quite simple. We must rename the targets.xml file and create a new file with the following content.
<Targets>
</Targets>
BashOnce created, start the Enterprise Manager agent.
emctl start agent
-bash: /bin/emctl: No such file or directory
[emc12@colbddtrj001 emd]$ which emctl
/u01/app/emc12/emagent/core/12.1.0.5.0/bin/emctl
[emc12@colbddtrj001 emd]$ /u01/app/emc12/emagent/core/12.1.0.5.0/bin/emctl start agent
Oracle Enterprise Manager Cloud Control 12c Release 5
Copyright (c) 1996, 2015 Oracle Corporation. All rights reserved.
Starting agent .......... started.
BashReferences:
https://community.oracle.com/thread/3674803?start=0&tstart=0