Many users facing issues while removing the Targets or Agents from Grid Control GUI. After removing the target, the Grid control GUI still shows the removed agent. The reason is the Repository still has reference of removed Targets or Agents.
Follow the manual steps to remove the Agent or Target completely from repository:
1. Make sure that agent/target stopped
For ex:- $ emctl stop agent
2. Connect to the Grid Control Repository as SYSMAN
3. Run below command to list all registered targets from OEM
SQL> select target_name from mgmt_targets where target_type=’oracle_emd’;
4. Remove the Agent/Target from the list using below command.
SQL> exec mgmt_admin.cleanup_agent(‘Target1:3673');
You may receive below error while running “mgmt_admin.cleanup_agent”
1. ERROR at line 1:
ORA-20206: Target does not exist: Target1:3673'
ORA-06512: at "SYSMAN.MGMT_ADMIN", line 846
ORA-06512: at line 1
Check for errors in emoms.trace file, which are referring to removed agent.
[AJPRequestHandler-ApplicationServerThread-19] ERROR eml.OMSHandshake java.? - OMSHandshake failed.(AGENT URL = https://agenthostname.domainname:port/emd/main/)(ERROR = KEY_MISMATCH)
Run the following EMDIag kit fix to resolve the issue
$ repvfy verify loaders -test 700 –fix
2. “ORA-20206: Target does not exist” Error message on mgmt_admin.cleanup_agent and there is no target in sysman.mgmt_targets, but there is a record in sysman.mgmt_targets_delete without delete_complite_time set.
If anyone comes across such situation then run below command for each target without delete_complete_time set.
SQL > Exec mgmt_admin.delete_target_internal(Target_name,Target_type)
3. Ora 20221: Insufficient privileges: /WITH_ADMIN
ORA-6512: at "SYSMAN.MGMT_ADMIN",
line 400 ORA-6512: at line 1
This issue can occur in 10.1.0.3 due to a BUG 3574400. Download and apply patch 3574400 to resolve the issue.