$<EMCLI_HOME>/emcli delete_target -name="hostname:3872" -type="oracle_emd" -delete_monitored_targets -async
Note: The above deletes the Agent and ALL its monitored targets from the repository.
"-delete_monitored_targets" : Delete the targets monitored by the specified Management Agent. Applicable only with the oracle_emd target type.
Sometimes individual targets wont get deleted. For that use the below command to delete it.
b) To delete a specific target:
$<EMCLI_HOME>/emcli delete_target -name="<target_name>" -type="<target_type>"
To find the target related information run the below command in OMS database:
select distinct target_name,target_type from SYSMAN.MGMT$TARGET where target_name like '%HOSTNAME%';
To completely remove a target from OMS database: