When someone trying to re-add a Domain Manager to the Enterprise the following error shows up:
DSM Explorer
============
Domain already exists in Enterprise [CMM000235]
<OK>
Client Automation - All versions
Sometimes there are situations where a Domain Manager has been removed from the Enterprise Manager, but there are still some remaining links left.
The following ref. article has a SQL script to unlink the Domain Manager through via SQL queries:
Unlink a Domain Manager and Enterprise Server via SQL queries
The reference record for Domain Manager in ca_n_tier tables still showed and cannot be deleted in the Enterprise Manager database:
select * from ca_n_tier (take not of the <domain_uuid_domain_manager> to be removed.)
Due to some left links when the DM was removed, some constraints errors do not allow the script running on EM side to complete successfully. In the specific case the errors returned were:
Msg 547, Level 16, State 0, Line 60
The DELETE statement conflicted with the REFERENCE constraint "$ca_di_r00000a2f00000000".
The conflict occurred in database "mdb", table "dbo.ca_discovered_user", column 'domain_uuid'.
The statement has been terminated.
Msg 547, Level 16, State 0, Line 49
The DELETE statement conflicted with the REFERENCE constraint "$ca_li_r000008be00000000".
The conflict occurred in database "mdb", table "dbo.ca_link_dis_user_sec_profile", column 'user_uuid'.
The statement has been terminated.
The following query deletes the remaining link causing the error.
delete from ca_link_dis_user_sec_profile
where user_uuid in (select user_uuid from ca_discovered_user
where domain_uuid = <domain_uuid_domain_manager>)
The above query delete entries which were creating foreign key constraint error while executing the script for deletion of entries in EM side. After that, delete from ca_n_tier.
delete from ca_n_tier where domain_uuid = <domain_uuid_domain_manager>
Re-run the script on the EM database side.
When completed go to the DSM Explorer and re-add the Domain Manager to the Enterprise Server to recreate the replication.