When attempting to delete an integration in SmartConnect On-Premise, you may encounter the following error:
“Cannot delete the integration, the following errors has occurred:
could not execute native bulk manipulation query: DELETE FROM TraceHeader WHERE MapKey = :param1 and CustomerId =:param2″


This issue can occur when a large number of trace/log records have accumulated in the TraceHeader and TraceLine tables for the integration.
Causes
SmartConnect maintains execution and trace information in the TraceHeader and TraceLine tables if you enable logging for integration under the Options tab. If these tables contain a significant volume of historical records, SmartConnect may encounter difficulties when attempting to remove the associated trace records during integration deletion.
This can prevent the integration from being deleted successfully.
Solution – Fixing “Cannot Delete the Integration” Error
To resolve the issue, you can manually remove the trace records associated with the integration from the SmartConnect database.
Step 1: Check the Number of Trace Records
Before deleting anything, check how many records are associated with the integration and run the following queries against the SmartConnect database.
Note: Replace XXXXXXXXX in the queries below with the Map ID / Integration ID of the affected integration.
select count(l.TraceLineId) as [count] from TraceLine l with (nolock) left join TraceHeader h with (nolock) on l.TraceHeaderId = h.TraceHeaderId where h.MapId = 'XXXXXXXXX' select count(h.TraceHeaderId) as [count] from TraceHeader as h with (nolock) where h.MapId = 'XXXXXXXXX'
Step 2: Delete the Trace Records
After confirming the record counts and ensuring that it is safe to proceed, run in the same order: likely TraceLine first and TraceHeader next.
Note: Replace XXXXXXXXX in the queries below with the Map ID / Integration ID of the affected integration.
delete l from TraceLine l with (nolock) left join TraceHeader h with (nolock) on l.TraceHeaderId = h.TraceHeaderId where h.MapId = 'XXXXXXXXX' delete h from TraceHeader as h with (nolock) where h.MapId = 'XXXXXXXXX'
Verify the Cleanup
After completing the deletion, you can run the count queries from Step 1 again to confirm that the records associated with the integration have been removed.
You can then return to SmartConnect and attempt to delete the integration again.
Have a question? Please reach out to us at support@eonesolutions.com.