Got the following error when trying to add a target on 12c Grid Control
TEST:
oracle.sysman.emSDK.core.target.DuplicateEntityException: ORA-20500: TEST:oracle_database:testprd:https://testprd:3872/emd/main/:3:0 ORA-06512: at "SYSMAN.EM_TARGET", line 3347 ORA-06512: at line 1 - ORA-20500: TEST:oracle_database:testprd:https://testprd:3872/emd/main/:3:0 ORA-06512: at "SYSMAN.EM_TARGET", line 3347 ORA-06512: at line 1
To fix this we just need to remove the entry from the repository, so connect to the repository database as sysman and run the following
exec mgmt_admin.delete_target(‘TEST’,'oracle_database’);
It may take a few mins to delete but you can check by either looking in the health overview window in grid control – setup > manage cloud control > health overview and click on the value next to deleted targets this will list when the target was deleted.
You can also check by running the following sql against the repository database as sysman
set linesize 180
column TARGET_NAME format a30
column TARGET_TYPE format a15
column DISPLAY_NAME format a30
column HOST_NAME format a30
column EMD_URL format a45
select TARGET_NAME, TARGET_TYPE, DISPLAY_NAME, HOST_NAME, EMD_URL from mgmt_targets where target_type=’oracle_database’ and target_name like ‘%TEST%’;