Upload replication is failing and Engine log shows A database constraint violation error occurred for table: ca_discovered_software

book

Article ID: 5936

calendar_today

Updated On:

Products

CA Automation Suite for Data Centers - Configuration Automation CA Client Automation - Asset Management CA Client Automation - IT Client Manager CA Client Automation CA Client Automation - Remote Control CA Client Automation - Asset Intelligence CA Client Automation - Desktop Migration Manager CA Client Automation - Patch Manager

Issue/Introduction

Upload replication is failing and Engine log shows 

A database constraint violation error occurred for table: ca_discovered_software 

Cause

Check Engine Logs: 

131016-14:45:04.8626566L|004788|00000f84|Domain_tas|amLog | |000000|ERROR | SetIntermediateStatus2: Upload: A database constraint violation error occurred for table: ca_discovered_software 
131016-14:45:04.9051620L|004788|00000f84|Domain_tas|amLog | |000000|ERROR | DoTableUpdate - DB Constraint violated, record marked for later replication rc=[0] sql=[insert into ca_discovered_software (sw_def_uuid,dis_sw_uuid,label,serial_number,creation_user,creation_date,last_update_user,product_guid,last_update_date,install_path,last_accessed,asset_source_uuid,license_uuid,exclude_registration,delete_time,is_managed_by_service,is_ignored_by_vuln_impact,trustlevel,origin,def_source_type_id,dis_source_type_id,license_id,license_instance,license_block_id,covered_by_nf,detection_ref,test,custom) values (?,?,?,?,?,1455410084,?,?,1455410084,?,NULL,?,?,NULL,NULL,NULL,NULL,5,?,1,1,0,NULL,NULL,NULL,?,NULL,?)] 

Environment

ITCM 12.9,14.0 Domain & Enterprise manager Replication task.

Resolution

Check the Engine logs and see if you have above mentioned Error. 

Please execute below queries on domain manager SQL query Analyzer . 

Unlink the upload Replication task from Engine Before executing below queries. 

1. UPDATE disc SET asset_source_uuid = NULL FROM ca_discovered_software disc LEFT JOIN ca_agent agent on disc.asset_source_uuid = agent.object_uuid WHERE disc.asset_source_uuid IS NOT NULL AND agent.object_uuid IS NULL 

Add the Upload Replication task to Engine and try running it again. If error persists even after executing the above query then  execute the below query by unlink the Upload Replication task.  

2. update ca_replication_status set modified_status =0x0 where replication_conf_uuid in 

(select replication_conf_uuid from ca_replication_conf where table_name ='ca_discovered_hardware' and direction>-1) 

Now Add the upload replication task again and run . Open a issue with CA if it still shows ERROR.